本文整理汇总了PHP中JSession::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JSession::getInstance方法的具体用法?PHP JSession::getInstance怎么用?PHP JSession::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSession
的用法示例。
在下文中一共展示了JSession::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAjax
public static function getAjax()
{
jimport('joomla.application.module.helper');
$input = JFactory::getApplication()->input;
$module = JModuleHelper::getModule('hoicoi_openmeetings');
$params = new JRegistry();
$params->loadString($module->params);
$values = explode(',', rtrim($params->get('rooms'), ","));
if (self::getVerification($values, $input->get("room_id"), $input->get("password", "", 'STRING'))) {
$options = array("protocol" => $params->get('protocol'), "port" => $params->get('port'), "host" => $params->get('host'), "webappname" => $params->get('webappname'), "adminUser" => $params->get('adminUser'), "adminPass" => $params->get('adminPass'));
$access = new openmeetings_gateway($options);
if (!$access->loginuser()) {
$data = array("error" => 03, "text" => self::getErrorInfo(03));
return $data;
}
$hash = $access->setUserObjectAndGenerateRoomHash($input->get("name"), $input->get("name", "", 'STRING'), "", "", $input->get("email", "", 'STRING'), JSession::getInstance("", "")->getId(), "Joomla", $input->get("room_id"), self::$isAdmin, self::$isRecodring);
if (preg_match('/\\D/', $hash)) {
$url = $access->getUrl() . "/?secureHash=" . $hash;
//Get final URL
$data = array("url" => $url);
return $data;
} else {
$data = array("error" => $hash, "text" => self::getErrorInfo($hash));
return $data;
}
} else {
$data = array("error" => 02, "text" => self::getErrorInfo(02));
return $data;
}
$data = array("error" => 01, "text" => self::getErrorInfo(01));
return $data;
}
示例2: loadSession
public function loadSession(JSession $session = null)
{
if ($session !== null) {
$this->session = $session;
return $this;
}
// Generate a session name.
$name = md5($this->get('secret') . $this->get('session_name', get_class($this)));
// Calculate the session lifetime.
$lifetime = $this->get('lifetime') ? $this->get('lifetime') * 60 : 900;
// Get the session handler from the configuration.
$handler = $this->get('session_handler', 'none');
// Initialize the options for JSession.
$options = array('name' => $name, 'expire' => $lifetime);
$session = JSession::getInstance($handler, $options);
$session->initialise($this->input, $this->dispatcher);
if ($session->getState() == 'expired') {
$session->restart();
} else {
$session->start();
}
// Set the session object.
$this->session = $session;
return $this;
}
示例3: clear
/**
* Empty the cart
*/
public function clear()
{
// Find session
$this->session = \JSession::getInstance('_compayfast_', array());
$this->session->set('cart', array());
// Done
$this->display();
}
示例4: testGetInstance
/**
* Test getInstance
*
* @param string $store Type of storage for the session
* @param array $options Optional parameters
*
* @dataProvider casesGetInstance
* @covers JSession::getInstance
*
* @return void
*/
public function testGetInstance($store, $options)
{
$oldSession = $this->object;
$newSession = JSession::getInstance($store, $options);
// The properties and values should be identical to each other.
$this->assertThat($oldSession, $this->identicalTo($newSession));
// They should be the same object.
$this->assertSame($oldSession, $newSession);
}
示例5: 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;
}
示例6: display
function display($tpl = null)
{
jimport( 'joomla.session.session' );
$currentSession = JSession::getInstance('none',array());
$currentSession->set("search_fields","");
$currentSession->set("searchfieldscatid",0);
$currentSession->set("searchfieldssql"," 1 ");
$currentSession->set("tsearch","",'adsmanager');
$app = JFactory::getApplication();
$pathway = $app->getPathway();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$contentmodel =$this->getModel( "content" );
$catmodel =$this->getModel( "category" );
$configurationmodel =$this->getModel( "configuration" );
// Get the parameters of the active menu item
$menus = $app->getMenu();
$menu = $menus->getActive();
$conf = $configurationmodel->getConfiguration();
$rootid = JRequest::getInt('rootid',0);
$cats = $catmodel->getFlatTree(true, true, $nbContents, 'read',$rootid);
$this->assignRef('cats',$cats);
$this->assignRef('conf',$conf);
$document->setTitle( JText::_('ADSMANAGER_PAGE_TITLE'));
$general = new JHTMLAdsmanagerGeneral(0,$conf,$user);
$this->assignRef('general',$general);
$conf = $configurationmodel->getConfiguration();
$nbimages = $conf->nb_images;
if (function_exists("getMaxPaidSystemImages"))
{
$nbimages += getMaxPaidSystemImages();
}
$this->assignRef('nbimages',$nbimages);
$nb_cols = $conf->nb_last_cols;
$nb_rows = $conf->nb_last_rows;
$contents = $contentmodel->getLatestContents($nb_cols*$nb_rows,0,"no",$rootid);
$this->assignRef('contents',$contents);
parent::display($tpl);
}
示例7: prepareTable
protected function prepareTable($table)
{
$session = JSession::getInstance();
$fname = $session->get('FNAME_DB');
$fsize = $session->get('FSIZE_DB');
if (!empty($fname)) {
$table->filename = $fname;
$table->file_size = $fsize;
}
}
示例8: store
function store()
{
jimport("joomla.database.table.user");
$my = JFactory::getUser();
$new_user = "0";
if (!$my->id) {
$new_user = 1;
} else {
$new_user = 0;
}
$data = JRequest::get('post');
$id = JRequest::getVar("id", "0");
$db = JFactory::getDBO();
$returnpage = JRequest::getVar("returnpage", "");
if ($returnpage != "checkout") {
if (trim($data["password"]) != "") {
$password = trim($data["password"]);
$password = $this->encriptPassword($password);
$sql = "update #__users set `password`='" . trim($password) . "' where `id`=" . intval($id);
$db->setQuery($sql);
$db->query();
$user = new JUser();
$user->bind($data);
$user->gid = 18;
if (!$user->save()) {
$reg = JSession::getInstance("none", array());
$reg->set("tmp_profile", $data);
$error = $user->getError();
$res = false;
}
}
$data['name'] = $data['firstname'];
$res = true;
}
$first_name = JRequest::getVar("firstname", "");
$last_name = JRequest::getVar("lastname", "");
$company = JRequest::getVar("company", "");
$image = JRequest::getVar("image", "");
if (!$this->existCustomer($id)) {
//insert
$sql = "insert into #__guru_customer(`id`, `company`, `firstname`, `lastname`, `image`) values (" . intval($id) . ", '" . addslashes(trim($company)) . "', '" . addslashes(trim($first_name)) . "', '" . addslashes(trim($last_name)) . "', '" . addslashes(trim($image)) . "')";
} else {
//update
$sql = "update #__guru_customer set company='" . addslashes(trim($company)) . "', firstname='" . addslashes(trim($first_name)) . "', lastname='" . addslashes(trim($last_name)) . "', image='" . addslashes(trim($image)) . "' where id=" . intval($id);
}
$db->setQuery($sql);
if ($db->query()) {
return true;
}
return false;
}
示例9: getSessionData
/**
*
* Ajax load data render
*/
public function getSessionData()
{
$name = JString::strtolower(JRequest::getVar('session_name', ''));
$session = JSession::getInstance('files', array('name' => 'jsnajaxgetrender'));
switch ($name) {
case 'component':
echo $session->get('component');
$session->set('component', '');
break;
case 'jsondata':
echo $session->get('jsondata');
$session->set('jsondata', '');
break;
}
jexit();
}
示例10: display
/**
*
*/
function display($tpl = null)
{
// Assign data to the view
$this->msg = $this->get('Msg');
$this->items = $this->get('Items');
// Check of cart session
$this->session = \JSession::getInstance('_compayfast_', array());
$this->cart = $this->session->get('cart', false);
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JLog::add(implode('<br />', $errors), JLog::WARNING, 'jerror');
return false;
}
// Display the view
parent::display($tpl);
}
示例11: display
public function display($tpl = null)
{
$this->form = $this->get("Form");
//DownfilesModelItem::getForm()
$this->item = $this->get("Item");
// DownfilesModelItem::getItem()
$itemID = JFactory::getApplication()->input->get('id');
if (!empty($itemID)) {
//записываем в сессию имя текущего файла
$session = JSession::getInstance();
$session->set("CUR_FILENAME", $this->item->filename);
}
$this->addToolBar();
parent::display($tpl);
$this->setDocument();
}
示例12: GCOOneOffPostForm
function GCOOneOffPostForm($orderInfo, $params = array())
{
$pConfig = oseMscConfig::getConfig('payment', 'obj');
$gco_id = $pConfig->google_checkout_id;
$gco_key = $pConfig->google_checkout_key;
$html = array();
$test_mode = $pConfig->gco_testmode;
if (empty($gco_id) || empty($gco_key)) {
$html['form'] = "";
$html['url'] = "";
return $html;
}
if ($test_mode == true) {
$url = "https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/" . $gco_id;
} else {
$url = "https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/" . $gco_id;
}
$db = oseDB::instance();
$member = oseRegistry::call('member');
$member->instance($orderInfo->user_id);
$billinginfo = self::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);
$desc = self::generateDesc($order_id);
$msc_name = $desc;
$orderInfoParams = oseJson::decode($orderInfo->params);
$returnUrl = urldecode(JROUTE::_(JURI::base() . "index.php?option=com_osemsc&view=thankyou&order_id=" . $order_id));
$returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}";
$vendor_image_url = "";
$app = JFactory::getApplication();
$currentSession = JSession::getInstance('none', array());
$stores = $currentSession->getStores();
$html['form'] = '<form action="' . $url . '" method="post" >';
$post_variables = array("item_name_1" => $desc . ' - ' . JText::_('ORDER_ID') . ' ' . $order_id, "item_description_1" => JText::_('UNIQUE_ORDER_NUMBER') . ':' . $order_number, "item_merchant_id_1" => $order_id, "item_quantity_1" => "1", "item_price_1" => $amount, "item_currency_1" => $currency, "continue_url" => $returnUrl);
$html['form'] .= '<input type="image" id="gco_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Fast checkout through Google') . '" />';
// 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;
}
示例13: display
/**
* Display function
*/
public function display($tpl = null)
{
if (function_exists('error_reporting')) {
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT);
}
/** load libraries for the system rener **/
JSNFactory::localimport('libraries.joomlashine.mode.rawmode');
JSNFactory::localimport('libraries.joomlashine.menu.menuitems');
/** Assignment variables **/
$jsntemplate = JSNFactory::getTemplate();
$jsnmenuitems = JSNMenuitems::getInstance();
/** get url **/
$render_url = JRequest::getVar('render_url', '');
$session = JSession::getInstance('files', array('name' => 'jsnpoweradmin'));
if ($render_url == '' && $session->get('rawmode_render_url')) {
$render_url = $session->get('rawmode_render_url');
}
$urlRender = base64_decode($render_url);
if ($render_url == '') {
$urlRender = JSNDatabase::getDefaultPage()->link;
}
$currUri = new JURI($urlRender);
if (!$currUri->hasVar('Itemid')) {
$currUri->setVar('Itemid', JSNDatabase::getDefaultPage()->id);
}
$urlString = $currUri->toString();
$session->set('rawmode_render_url', base64_encode($urlString));
$parts = JString::parse_url($urlString);
if (!empty($parts['query'])) {
parse_str($parts['query'], $params);
} else {
$params = array();
}
$jsnrawmode = JSNRawmode::getInstance($params);
$jsnrawmode->setParam('positions', $jsntemplate->loadXMLPositions());
$jsnrawmode->renderAll();
$this->assign('component', $jsnrawmode->getHTML('component'));
$this->assign('modules', $jsnrawmode->getHTML('positions'));
$this->assign('jsnmenuitems', $jsnmenuitems);
$this->assign('urlRender', $urlRender);
/** add toolbar buttons **/
$this->addToolBar();
/** add scripts and css **/
//$this->addMedia( $currUri->getVar('Itemid'), $urlString, array());//$jsnrawmode->getScript('positions', 'Array'));
$this->addMedia($currUri->getVar('Itemid'), $urlString, $jsnrawmode->getScript('positions', 'Array'));
return parent::display();
}
示例14: getCart
/**
* Get the item entry
*/
public function getCart()
{
// Check of cart session
$this->session = \JSession::getInstance('_compayfast_', array());
$this->cart = $this->session->get('cart', false);
if ($this->cart) {
foreach ($this->cart as $key => $value) {
$select[] = $value;
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select all records
$query->select(array('I.*', 'O.id AS oid', 'O.option', 'O.price'));
$query->from('`#__compayfast_items` I');
$query->join('RIGHT', '`#__compayfast_options` O ON (I.id = O.item_id)');
$query->where('O.id IN (' . implode($select, ',') . ')');
$query->order('title ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();
// Sort
foreach ($results as $key => $value) {
// Regroup results
$newResults[$value->slug][] = $value;
// Find total
$total[] = $value->price;
}
$return['newResults'] = $newResults;
$return['total'] = array_sum($total);
//print "<pre>"; print_r($newResults); print "</pre>";
} else {
$return = array();
}
// Return new results
return $return;
}
示例15: get_gcoform
function get_gcoform($orderInfo)
{
$parameters =& JComponentHelper::getParams('com_osemsc');
$google_checkout_id = $parameters->get('google_checkout_id');
$html = array();
if (empty($google_checkout_id)) {
$html['form'] = "";
return $html;
}
/*
$db = &JFactory::getDBO();
require_once (JPATH_ADMINISTRATOR . DS . "components" . DS . "com_osemsc" . DS . "warehouse" . DS . "public.php");
$query = "SELECT name FROM `#__osemsc_acl` WHERE id = '{$msc_id}'";
$db->setQuery($query);
$msc_name = $db->loadResult();
$query = "SELECT * FROM `#__osemsc_ext` WHERE id = '{$msc_id}' AND type='msc'";
$db->setQuery($query);
$msc_data = $db->loadObject();
$msc_data = publicTools::parseParams($msc_data);
*/
$msc_id = $orderInfo->entry_id;
$node = oseMscTree::getNode($msc_id, 'obj');
$msc_name = $node->title;
$payment = oseMscAddon::getExtInfo($msc_id, 'payment', 'obj');
$price = $orderInfo->payment_price;
$currency = $orderInfo->payment_currency;
$order_id = $orderInfo->order_id;
$order_number = $orderInfo->order_number;
//$renewal_discounts = $msc_data->renewal_discounts;
//$promotion_code = $msc_data->promotion_code;
//$promotion_discounts = $msc_data->promotion_discounts;
//if ($user_promotion_code == $promotion_code)
//{
// $amount = $amount * (1-$promotion_discounts/100);
//}
// Check if the user is a member of the membership
//require_once(JPATH_ADMINISTRATOR.DS."components".DS."com_osemsc".DS."warehouse".DS."api.php");
//$api=new OSEMSCAPI();
////if ($api->is_member($msc_id, $user_id)==true)
//{
// if (!empty($renewal_discounts))
// {
// $amount = $amount * (1-$renewal_discounts/100);
// $a1= $a1 * (1-$renewal_discounts/100);
// }
//}
// Renewal discounts ends
$vendor_image_url = "";
$app =& JFactory::getApplication();
$currentSession = JSession::getInstance('none', array());
$stores = $currentSession->getStores();
if ($currency == "GBP") {
$country_code = "UK";
} elseif ($currency == "USD") {
$country_code = "US";
}
$url = "https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/" . $google_checkout_id;
$post_variables = array("item_name_1" => JText::_('Order ID: ') . $order_id, "item_description_1" => JText::_('Payment for Membership Type: ') . $msc_name . "||" . $order_number, "item_merchant_id_1" => $order_id, "item_quantity_1" => "1", "item_price_1" => $price, "item_currency_1" => $currency, "continue_url" => JURI::base() . "index.php?option=com_osemsc&view=member&result=success");
$html['form'] = '<form action="' . $url . '" method="post" target="_self" id="google" name="google"><input type="hidden" name="phpMyAdmin" value="octl53wDFSC-rSEy-S6gRa-jWtb" />';
$html['form'] .= '<input id="gco-image" type="image" name="Google Checkout" alt="Fast checkout through Google"
src="components/com_osemsc/assets/images/checkout.png?merchant_id=' . $google_checkout_id . '&style=white&variant=text&loc=en_US"/>';
foreach ($post_variables as $name => $value) {
$html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
}
$html['form'] .= '</form>';
return $html;
}