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);
	}
示例#2
0
 function __call($name, $args)
 {
     if (isset($this->task[$name])) {
         return call_user_func_array(array($this, $this->task[$name]), $args);
     } else {
         oseExit($name . 'Error');
     }
 }
示例#3
0
function oseCheckToken()
{
    $tokenCheck = JRequest::checkToken();
    if (empty($tokenCheck)) {
        $result['content'] = 'Token is invalid!';
        $result = oseJson::encode($result);
        oseExit($result);
    }
}
示例#4
0
 public static function getGroups($params = array())
 {
     $msc_id = JRequest::getInt('msc_id', 0);
     $msc = oseRegistry::call('msc');
     $item = $msc->getExtInfo($msc_id, 'jgroup', 'obj');
     $jgroup_id = oseObject::getValue($item, 'jgroup_id', null);
     $gid = JHtml::_('access.usergroups', 'jgroup_jgroup_id', $jgroup_id, true);
     oseExit($gid);
 }
示例#5
0
	function getTerm()
	{
		$id = JRequest::getInt('id',0);

		$terms = oseRegistry::call('member')->getInstance('Email')->getTerm($id);
		$terms = str_replace("../", JURI::root(), $terms);
		$result = empty($terms)?'':$terms;
		$result = oseJson::encode($result);
		oseExit($result);
	}
示例#6
0
 function getOptions()
 {
     $model = $this->getModel('daily');
     $result = $model->getOptions();
     if (count($result['results']) < 1) {
         $result['total'] = 0;
     }
     $result = oseJSON::encode($result);
     oseExit($result);
 }
示例#7
0
 public static function getInstance($type)
 {
     $className = "oseContent{$type}";
     if (class_exists($className)) {
         static $instance;
         if (!$instance instanceof $className) {
             $instance = new $className();
         }
         return $instance;
     } else {
         oseExit('Can Not Get the Instance of OSEFILE');
     }
 }
示例#8
0
 function getOwnMsc()
 {
     $model = $this->getModel('member');
     $items = $model->getOwnMsc();
     $total = count($items);
     if ($total > 0) {
         $result['total'] = $total;
         $result['results'] = $items;
     } else {
         $result['total'] = 0;
         $result['results'] = null;
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#9
0
 function getList()
 {
     $model = $this->getModel('levels');
     $results = $model->getList();
     $result = array();
     if (count($results) > 0) {
         $result['total'] = count($results);
         $result['results'] = $results;
     } else {
         $result['total'] = 0;
         $result['results'] = array();
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#10
0
 function __call($name, $args)
 {
     if (isset($this->task[$name])) {
         return call_user_func_array(array($this, $this->task[$name]), $args);
     } else {
         $t = debug_backtrace(false);
         foreach ($t as $d) {
             if (isset($d['file'])) {
                 echo $d['file'] . ' ' . $d['function'] . ' line:' . $d['line'];
                 echo "<br \\>";
             }
         }
         echo get_class($this) . '::' . $name . ' Error';
         oseExit();
     }
 }
示例#11
0
	function getFaith()
	{
		$id = JRequest::getInt('id',0);
		$db= oseDB::instance();
		
		$query = " SELECT * FROM `#__osemsc_email` "
				." WHERE type = 'faith' AND id = {$id} "
				;
		
		$db->setQuery($query);
		
		$term = oseDB::loadItem();
		
		$result = empty($term)?'':$term;
		
		$result = oseJson::encode($result);
		
		oseExit($result);
	}
 function __construct($orderInfo, $pgwParams, $testMode = false)
 {
     parent::__construct();
     $this->orderInfo = $orderInfo;
     $this->test = $testMode;
     if ($testMode) {
         $this->eWayCustomerID = '87654321';
         $this->eWayUsername = '******';
         $this->eWayPassword = '******';
         $this->soap_link = 'https://www.eway.com.au/gateway/rebill/test/managerebill_test.asmx';
     } else {
         $currency = oseObject::getValue($this->orderInfo, 'payment_currency');
         $this->eWayCustomerID = oseObject::getValue($pgwParams, "eWayCustomerID_{$currency}");
         $this->eWayUsername = oseObject::getValue($pgwParams, "eWayUsername_{$currency}");
         $this->eWayPassword = oseObject::getValue($pgwParams, "eWayPassword_{$currency}");
         $this->soap_link = 'https://www.eway.com.au/gateway/rebill/managerebill.asmx';
     }
     if (empty($this->eWayCustomerID)) {
         oseExit(getErrorMessage('cc', 00, 'Since the currency you are going to pay is not supported, the transaction will be aborted!'));
     }
 }
示例#13
0
	function generateOrderView() {
		$order_id = JRequest::getInt('order_id', 0);
		$my = JFactory::getUser();
		$where = array();
		$where[] = " `order_id` = {$order_id}";
		$where[] = " `user_id` = {$my->id}";
		$orderInfo = oseRegistry::call('payment')->getOrder($where, 'obj');
		if (empty($orderInfo)) {
			$result = array();
			$result['title'] = 'Error';
			$result['content'] = 'Error';
			oseExit('Error');
		}
		$receipt = oseRegistry::call('member')->getReceipt($orderInfo);
		$document = &JFactory::getDocument();
		$document->setTitle($receipt->subject);
		$document->setName('Invoice-#' . $order_id);
		$document->setDescription('Invoice-#' . $order_id);
		$document->setMetaData('keywords', 'Invoice');
		// prepare header lines
		$document->setHeader('Invoice Create Date:' . $orderInfo->create_date);
		echo $receipt->body;
	}
示例#14
0
 function getCouponHistory()
 {
     $db = oseDB::instance();
     $id = JRequest::getInt('id', 0);
     $start = JRequest::getInt('start', 0);
     $limit = JRequest::getInt('limit', 25);
     $paid = JRequest::getInt('paid', -1);
     $where = array();
     $where[] = ' c.`coupon_id` = ' . $db->Quote($id);
     if ($paid >= 0) {
         $where[] = ' c.`paid` = ' . $db->Quote($paid);
     }
     $where = oseDB::implodeWhere($where);
     $query = " SELECT count(*) FROM `#__osemsc_coupon_user` AS c" . $where;
     $db->setQuery($query);
     $total = $db->loadResult();
     $query = " SELECT c.* FROM `#__osemsc_coupon_user` AS c" . $where;
     $db->setQuery($query, $start, $limit);
     $items = $db->loadObjectlist();
     foreach ($items as $item) {
         $user_id = $item->user_id;
         $query = " SELECT username FROM `#__users`" . " WHERE `id` = '{$user_id}'";
         $db->setQuery($query);
         $username = $db->loadResult();
         $item->username = empty($username) ? 'Guest' : $username;
     }
     $result = array();
     $result['total'] = $total;
     $result['results'] = $items;
     $result = oseJSON::encode($result);
     oseExit($result);
 }
示例#15
0
	function saveOption()
	{
		$config = osemscPublic::getConfig('register','obj');
		$msc_id = JRequest::getInt('msc_id',0);
		$msc_option = JRequest::getCmd('msc_option',null);

		if($config->register_form == 'onestep')
		{
			$cart = oseMscPublic::getCart();

			//$cart = oseMscPublic::getCart();
			$item = array('entry_id'=>$msc_id,'entry_type'=>'msc','msc_option'=>$msc_option);
			$cart->addItem($item['entry_id'],$item['entry_type'],$item);
			$cart->update();
		}

		oseExit(true);
	}
示例#16
0
	private function jvsave($member_id, $post) {
		$mainframe = JFactory :: getApplication();
		$option = JRequest :: getCmd('option');
		// Initialize some variables
		$msg = "";
		$me = & JFactory :: getUser();
		$MailFrom = $mainframe->getCfg('mailfrom');
		$FromName = $mainframe->getCfg('fromname');
		$SiteName = $mainframe->getCfg('sitename');
		// Create a new JUser object
		$user = new JUser($member_id);
		$original_gid = $user->get('gid');
		if (!$user->bind($post)) {
			$result = array ();
			$result['success'] = false;
			$result['title'] = 'Error';
			$result['content'] = JText :: _('Failed Updating Member Information');
			$result = oseJSON :: encode($result);
			oseExit($result);
		}
		// Are we dealing with a new user which we need to create?
		$isNew = ($user->get('id') < 1);
		if (!$isNew) {
			// if group has been changed and where original group was a Super Admin
			if ($user->get('gid') != $original_gid && $original_gid == 25) {
				// count number of active super admins
				$query = 'SELECT COUNT( id )' .				' FROM #__users' .				' WHERE gid = 25' .				' AND block = 0';
				$this->db->setQuery($query);
				$count = $this->db->loadResult();
				if ($count <= 1) {
					$result = array ();
					$result['success'] = false;
					$result['title'] = 'Error';
					$result['content'] = JText :: _('Failed Updating Member Information');
					$result = oseJSON :: encode($result);
					oseExit($result);
				}
			}
		}
		/*
			 * Lets save the JUser object
			 */
		if (!$user->save()) {
			$result = array ();
			$result['success'] = false;
			$result['title'] = 'Error';
			$result['content'] = $user->getError();
			$result = oseJSON :: encode($result);
			oseExit($result);
		}
		// For new users, email username and password
		// Capture the new user id
		if ($isNew) {
			$newUserId = $user->get('id');
		} else {
			$newUserId = null;
		}
		return $newUserId;
	}
示例#17
0
 function exportCsvAll()
 {
     $model = $this->getModel('memlist');
     $model->exportCsvAll();
     oseExit();
 }
示例#18
0
	function clearCart() {
		$cart = oseMscPublic::getCart();
		$cart->cart = array();
		$cart->update();
		oseExit('dfasdf');
	}
示例#19
0
 function remove()
 {
     $msc_ids = JRequest::getVar('msc_ids', array(), 'post', 'array');
     $model = $this->getModel('memberships');
     if ($model->remove($msc_ids)) {
         $result['success'] = true;
         $result['title'] = JText::_('DONE');
         $result['content'] = JText::_('REMOVE_SUCCESSFULLY');
     } else {
         $result['success'] = false;
         $result['title'] = JText::_('ERROR');
         $result['content'] = JText::_('FAIL_TO_REMOVE');
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#20
0
	function getOrderMembershipTable()
	{
		$order_id = JRequest::getInt('order_id',0);
		$db = oseDB::instance();
		$my = JFactory::getUser();

		$member = oseRegistry::call('member');

		$memEmail = $member->getInstance('Email');

		$tableHtml = $memEmail->generateOrderTable($order_id,$my->id);
		$tableHtml = preg_replace('/100%/','90%',$tableHtml,1);
		oseExit($tableHtml);
	}
示例#21
0
	function getGmapJs()
	{
		$link = oseRegistry::call('msc')->getInstance('Config')->generateGmapScript();
		
		echo '<script type="text/javascript" src="'.$link.'"></script>';
		
		$com = OSECPU_PATH_JS.'/com_ose_cpu/extjs';
		
		echo '<script type="text/javascript" src="'.$com.'/ose/app.msg.js"></script>';

		oseExit();
	}
示例#22
0
 function getMod()
 {
     $result = array();
     $type = JRequest::getCmd('type', null);
     echo '<script type="text/javascript">' . "\r\n";
     require_once OSEMSC_B_VIEW . DS . $type . DS . 'js' . DS . 'ext.' . $type . '.js';
     echo "\r\n" . '</script>';
     oseExit();
 }
示例#23
0
 public static function getOptions()
 {
     $msc_id = JRequest::getInt('msc_id', 0);
     $msc = oseRegistry::call('msc');
     $node = $msc->getInfo($msc_id, 'obj');
     $paymentInfos = $msc->getExtInfo($msc_id, 'payment');
     $cart = oseMscPublic::getCart();
     $osePaymentCurrency = $cart->get('currency');
     $option = oseMscPublic::generatePriceOption($node, $paymentInfos, $osePaymentCurrency);
     $options = array();
     $options = array_merge($options, $option);
     /*
     		$session =& JFactory::getSession();
         	$osePaymentCurrency = $session->get('osePaymentCurrency',oseRegistry::call('msc')->getConfig('currency','obj')->primary_currency);
         	$oseMscPayment = $session->get('oseMscPayment',array('msc_id'=>0,'msc_option'=>0));
     
     		$option = array();
     
     		if(!empty($oseMscPayment['msc_option']))
     		{
     			$paymentInfo = oseObject::getValue($paymentInfos,$oseMscPayment['msc_option']);
     			$node = oseRegistry::call('payment')->getInstance('View')->getPriceStandard($node,$paymentInfo,$osePaymentCurrency);
     			$optionPrice = oseObject::getValue($node,'standard_price').' for every '.oseObject::getValue($node,'standard_recurrence') ;
     
     			if(oseObject::getValue($paymentInfo,'has_trial'))
     			{
     				$node = oseRegistry::call('payment')->getInstance('View')->getPriceTrial($node,$paymentInfo,$osePaymentCurrency);
     				$optionPrice .= ' ('.oseObject::getValue($node,'trial_price').' in first '.oseObject::getValue($node,'trial_recurrence').')';
     			}
     
     			$option[] = array('id'=>oseObject::getValue($paymentInfo,'id'),'text'=>$optionPrice);
     
     		}
     		else
     		{
     			foreach($paymentInfos as  $paymentInfo)
     			{
     				$node = oseRegistry::call('payment')->getInstance('View')->getPriceStandard($node,$paymentInfo,$osePaymentCurrency);
     				$optionPrice = oseObject::getValue($node,'standard_price').' for every '.oseObject::getValue($node,'standard_recurrence') ;
     
     				if(oseObject::getValue($paymentInfo,'has_trial'))
     				{
     					$node = oseRegistry::call('payment')->getInstance('View')->getPriceTrial($node,$paymentInfo,$osePaymentCurrency);
     					$optionPrice .= ' ('.oseObject::getValue($node,'trial_price').' in first '.oseObject::getValue($node,'trial_recurrence').')';
     				}
     
     				$option[] = array('id'=>oseObject::getValue($paymentInfo,'id'),'text'=>$optionPrice);
     			}
     
     		}
     */
     $combo = array();
     $combo['total'] = count($options);
     $combo['results'] = $options;
     $combo = oseJson::encode($combo);
     oseExit($combo);
 }
示例#24
0
 function validate()
 {
     $db = oseDB::instance();
     $result = array();
     $id = JRequest::getInt('id');
     $this->addOrderInfoFix($id);
     $query = " SELECT b.*,a.member_id,a.msc_id,a.id AS `fix_id`,a.email" . " FROM `#__osemsc_order_fix` AS a" . " INNER JOIN `#__osemsc_order` AS b ON b.order_id = a.order_id" . " WHERE b.`order_id` = '{$id}'" . " LIMIT 1";
     $db->setQuery($query);
     $item = oseDB::loadItem('obj');
     /*$query = " SELECT b.*"
     				." FROM `#__osemsc_order` AS b"
     				." WHERE b.`order_id` = '{$id}'"
     				." LIMIT 1"
     				;
     								
     		$db->setQuery($query);
     		$item = oseDB::loadItem('obj');
     		
     		$query = " SELECT a.member_id,a.msc_id,a.id AS `fix_id`,a.email"
     				." FROM `#__osemsc_order_fix` AS a"
     				." WHERE a.`order_id` = '{$id}'"
     				." LIMIT 1"
     				;
     										
     		$db->setQuery($query);
     		$fitem = oseDB::loadItem('obj');
     		if(empty($fitem))
     		{
     			$vals = array();
     			$vals['order_id'] = $id;
     			$fix_id = oseDB::insert('#__osemsc_order_fix',$vals);
     			
     			$item->fix_id = $fix_id;
     		}
     		else
     		{
     			$item->member_id = $fitem->member_id;
     			$item->msc_id = $fitem->msc_id;
     			$item->fix_id = $fitem->fix_id;
     			$item->email = $fitem->email;
     		}*/
     $updated = $this->apiCheck($item);
     $result = $updated;
     if ($updated['success']) {
         $query = " SELECT COUNT(*) FROM `#__osemsc_member`" . " WHERE `id` = '{$item->member_id}' AND `expired_date` > NOW()";
         $db->setQuery($query);
         $exists = $db->loadResult();
         if (!$result['finish']) {
             if ($exists > 0) {
                 $result['finish'] = true;
                 // update the order fix status
                 $ofVals = array();
                 $ofVals['id'] = $item->fix_id;
                 $ofVals['status'] = 'fixed';
                 oseDB::update("#__osemsc_order_fix", 'id', $ofVals);
                 /*
                 // update the 6month member, -1 day!
                 if($item->msc_id == 13 && $item->payment_method == 'authorize')
                 {
                 	$expired_date = " DATE_SUB(`expired_date` ,INTERVAL 1 DAY) ";
                 
                 	$query = " UPDATE `#__osemsc_member` "
                 	." SET  `expired_date` = {$expired_date}"
                 	." WHERE `id` = '{$item->member_id}'"
                 	;
                 	$db->setQuery($query);
                 	oseDB::query();
                 }
                 */
             } else {
                 $result['finish'] = false;
             }
         }
         $result['id'] = $id;
     } else {
         $result['finish'] = true;
     }
     oseExit(oseJson::encode($result));
 }
示例#25
0
 function getEmailParams()
 {
     //$type = JRequest::getVar('type','wel_email');
     $model = $this->getModel('emails');
     $Params = $model->getEmailParams();
     $result = array();
     if (empty($Params)) {
         $result = null;
     } else {
         foreach ($Params as $key => $value) {
             echo '<div><div>[' . $key . '] : ' . $value . '</div></div>';
         }
     }
     //$result = oseJSON::encode($result);
     oseExit();
 }
示例#26
0
 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'];
     // get the vm shopper group id of msc
     $query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'vm'";
     $db->setQuery($query);
     $data = $db->loadObject();
     $data = oseJson::decode($data->params);
     $query = "SELECT shopper_group_id FROM #__vm_shopper_vendor_xref WHERE user_id=" . (int) $member_id;
     $db->setQuery($query);
     $gid = $db->loadResult();
     if ($data->sg_id != $gid) {
         $result['success'] = true;
         $result['title'] = JText::_('Done');
         $result['content'] = JText::_("Done");
         return $result;
     }
     $query = "SELECT * FROM `#__osemsc_member` WHERE `member_id` = '{$member_id}' AND `status` = '1' ORDER BY `id` DESC";
     $db->setQuery($query);
     $Mems = $db->loadObjectList();
     if (!empty($Mems)) {
         $own_msc_id = $Mems[0]->msc_id;
         $query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$own_msc_id}' AND `type` = 'vm'";
         $db->setQuery($query);
         $ext = $db->loadObject();
         $ext = oseJson::decode($ext->params);
         $vm_sg_id = $ext->sg_id;
     } else {
         $query = "SELECT shopper_group_id FROM `#__vm_shopper_group` WHERE `default` = '1'";
         $db->setQuery($query);
         $vm_sg_id = $db->loadResult();
     }
     $query = "UPDATE `#__vm_shopper_vendor_xref` SET `shopper_group_id` =" . (int) $vm_sg_id . " WHERE `user_id` =" . (int) $member_id;
     $db->setQuery($query);
     if (!$db->query()) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = $db->getErrorMsg();
         oseExit($result);
     } else {
         $result['success'] = true;
         $result['title'] = JText::_('Done');
         $result['content'] = JText::_("Done");
         return $result;
     }
 }
示例#27
0
 public static function preview()
 {
     $result = array();
     $result['success'] = true;
     $result['uploaded'] = false;
     $result['img_path'] = null;
     $uploadImg = JRequest::getVar('directory_directory_logo', null, 'files', 'array');
     $des = JPATH_COMPONENT_SITE . DS . 'assets' . DS . 'tmpl_image' . DS . $uploadImg['name'];
     if (JFile::exists($uploadImg['tmp_name'])) {
         if (!self::checkImage($uploadImg['type'])) {
             $result['success'] = true;
             $result['uploaded'] = false;
             $result['img_path'] = null;
             $result['title'] = JText::_('Error');
             $result['content'] = JText::_('Only .gif,.png,.jpeg is allowed');
             $result = oseJson::encode($result);
             oseExit($result);
         }
         $result['img_path'] = OSEMSC_F_URL . "/assets/tmpl_image/{$uploadImg['name']}";
         //$uploadImg['tmp_name'].'.png';
         if (JFile::upload($uploadImg['tmp_name'], $des)) {
             $result['uploaded'] = true;
         }
         $result = oseJson::encode($result);
         oseExit($result);
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#28
0
 function getAddonTypes()
 {
     $model = $this->getModel('addons');
     $items = $model->getAddonTypes();
     $result = array();
     if (count($items) < 1) {
         $result['success'] = true;
         $result['total'] = 0;
         $result['results'] = null;
     } else {
         //$result['success'] = true;
         $result['total'] = count($items);
         $result['results'] = $items;
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#29
0
 function returnMessages($status, $messages)
 {
     $result = array();
     if ($status == true) {
         $result['success'] = true;
         $result['status'] = 'Done';
         $result['result'] = $messages;
     } else {
         $result['success'] = false;
         $result['status'] = 'Error';
         $result['result'] = $messages;
     }
     $result = oseJSON::encode($result);
     oseExit($result);
 }
示例#30
0
 function queryRebillTransactions()
 {
     $orderInfo = $this->get('orderInfo');
     $orderInfoParams = oseJson::decode(oseObject::getValue($orderInfo, 'params'));
     $postVar = array();
     $postVar['RebillID'] = oseObject::getValue($orderInfo, 'payment_serial_number');
     $postVar['RebillCustomerID'] = $orderInfoParams->RebillCustomerID;
     //$postVar['startDate'] = date('Y-m-d',strtotime('-1 day',strtotime(oseHTML::getDateTime())));
     //$postVar['endDate'] = date('Y-m-d',strtotime('+1 day',strtotime(oseHTML::getDateTime())));
     //$postVar['status'] = 'Future';
     $resArray = $this->_soapcall('QueryRebillEvent', $postVar, true);
     oseExit($resArray);
     $resArray = $resArray['QueryTransactionsResult'];
     if (!empty($resArray)) {
         $result['success'] = true;
         $result['title'] = JText::_('Cancel');
         $result['content'] = JText::_('Your membership subscription is cancelled.');
         return $result;
     } else {
         return $this->getErrorMessage('cc', '0004', $resArray['ErrorDetails']);
     }
 }