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; }
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; }
/** * Empty the cart */ public function clear() { // Find session $this->session = \JSession::getInstance('_compayfast_', array()); $this->session->set('cart', array()); // Done $this->display(); }
/** * 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); }
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; }
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); }
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; } }
function store() { jimport("joomla.database.table.user"); $my = JFactory::getUser(); $new_user = "******"; 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; }
/** * * 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(); }
/** * */ 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); }
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(); }
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; }
/** * 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(); }
/** * 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; }
public function getTagsDetail($id, $all = 1) { // For session $session = JSession::getInstance('none', array()); $getredfilter = $session->get('redfilter'); $db = JFactory::getDbo(); $productids = ""; if (count($getredfilter) > 0 && $all == 1) { $type_id = array(); $tag_id = array(); $k = 0; foreach ($getredfilter as $typeid => $tags) { $type_id[] = $typeid; $tags = explode(".", $tags); $tag_id[] = $tags[0]; if (count($getredfilter) - 1 == $k) { $lasttypeid = $typeid; $lasttagid = $tags[0]; } $k++; } $typeids = implode(",", $type_id); $tagids = implode(",", $tag_id); $query = "SELECT ra.product_id FROM #__redproductfinder_association_tag AS rat " . "LEFT JOIN #__redproductfinder_associations AS ra ON rat.association_id = ra.id " . "WHERE rat.type_id = " . $db->quote($lasttypeid) . " " . "AND rat.tag_id = " . $db->quote($lasttagid) . " "; $db->setQuery($query); $product = $db->loadObjectList(); $products = array(); for ($i = 0; $i < count($product); $i++) { $products[] = $product[$i]->product_id; } } $q = "SELECT DISTINCT j.tag_id AS tagid,ra.product_id,count(ra.product_id) AS ptotal, " . "CONCAT(j.tag_id,'.',j.type_id) AS tag_id, t.tag_name " . "FROM ((#__redproductfinder_tag_type j, #__redproductfinder_tags t ) " . "LEFT JOIN #__redproductfinder_association_tag as rat ON t.`id` = rat.`tag_id`) " . "LEFT JOIN #__redproductfinder_associations as ra ON ra.id = rat.association_id " . "WHERE j.tag_id = t.id " . "AND j.type_id = " . (int) $id . " "; if ($productids != "") { // Sanitize ids JArrayHelper::toInteger($products); $q .= " AND ra.product_id IN (" . implode(",", $products) . ") "; } $q .= " GROUP BY t.id ORDER BY t.ordering "; $db->setQuery($q); return $db->loadObjectList(); }
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; }
/** * Test getInstance * * @param string $store @todo * @param array $options @todo * * @dataProvider casesGetInstance * @covers JSession::getInstance * * @return void */ public function testGetInstance($store, $options) { $oldSession = $this->object; $newSession = JSession::getInstance($store, $options); $this->assertThat($oldSession, $this->identicalTo($newSession)); }
/** * Allows the application to load a custom or default session. * * The logic and options for creating this object are adequately generic for default cases * but for many applications it will make sense to override this method and create a session, * if required, based on more specific needs. * * @param JSession $session An optional session object. If omitted, the session is created. * * @return InstallationApplicationWeb This method is chainable. * * @since 3.1 */ public function loadSession(JSession $session = null) { // 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, 'force_ssl' => $this->get('force_ssl')); $this->registerEvent('onAfterSessionStart', array($this, 'afterSessionStart')); // Instantiate the session object. $session = JSession::getInstance($handler, $options); $session->initialise($this->input, $this->dispatcher); // Set the session object. $this->session = $session; // Register the session with JFactory. JFactory::$session = $session; return $this; }
/** * Create a session object * * @access private * @param array $options An array containing session options * @return object JSession * @since 1.5 */ private static function &_createSession($options = array()) { jimport('joomla.session.session'); //get the editor configuration setting $conf =& JFactory::getConfig(); $handler = $conf->getValue('config.session_handler', 'none'); // config time is in minutes $options['expire'] = $conf->getValue('config.lifetime') ? $conf->getValue('config.lifetime') * 60 : 900; $session = JSession::getInstance($handler, $options); if ($session->getState() == 'expired') { $session->restart(); } return $session; }
function getLatestContents($nbcontents, $sort_type = 0, $catselect = "no", $rootid = null) { switch ($sort_type) { /* Popular */ case 2: $order_sql = "ORDER BY a.views DESC,a.date_created DESC ,a.id DESC "; break; /* Random */ /* Random */ case 1: $order_sql = "ORDER BY RAND() "; break; /* Latest */ /* Latest */ case 0: default: $order_sql = "ORDER BY a.date_created DESC ,a.id DESC "; break; } if (version_compare(JVERSION, '1.6', 'ge')) { $listCategories = TPermissions::getAuthorisedCategories('read'); //If the variable is an array and if it's not empty, we add a filter to the request //If not we're not return any category if (is_array($listCategories) && !empty($listCategories)) { $categories = implode(',', $listCategories); $listCategories = " AND c.id IN (" . $categories . ") "; } else { $listCategories = " AND 0 "; } } else { $listCategories = ""; } $cat_query = ""; switch ($catselect) { case "no": break; case "-1": $catid = JRequest::getInt('catid', 0); if ($catid != 0 && $catid != -1) { $this->_db->setQuery("SELECT c.id, c.name,c.parent " . " FROM #__adsmanager_categories as c " . " WHERE c.published = 1 {$listCategories} ORDER BY c.parent,c.ordering"); $listcats = $this->_db->loadObjectList(); //List $list = array(); $list[] = $catid; $this->_recurseSearch($listcats, $list, $catid); $listids = implode(',', $list); $cat_query = "adcat.catid IN ({$listids}) AND "; } break; default: $this->_db->setQuery("SELECT c.id, c.name,c.parent " . " FROM #__adsmanager_categories as c " . " WHERE c.published = 1 {$listCategories} ORDER BY c.parent,c.ordering"); $listcats = $this->_db->loadObjectList(); $catsid = explode(',', $catselect); //List $list = array(); foreach ($catsid as $catid) { $list[] = $catid; $this->_recurseSearch($listcats, $list, $catid); } $listids = implode(',', $list); $cat_query = " adcat.catid IN ({$listids}) AND "; break; } if (ADSMANAGER_SPECIAL == 'newspaper') { $cat_query .= " (a.ad_publishtype = 'both' OR a.ad_publishtype = 'online') AND "; } $currentSession = JSession::getInstance('none', array()); $sql = $currentSession->get("sqlglobalfilter", ""); $globalfilter = ""; if ($sql != "") { $globalfilter = " AND {$sql} "; } $sql = " SELECT a.*,p.id as parentid,p.name as parent,c.id as catid, c.name as cat,u.username as user " . " FROM #__adsmanager_ads as a " . " INNER JOIN #__adsmanager_adcat as adcat ON adcat.adid = a.id " . " LEFT JOIN #__users as u ON a.userid = u.id " . " INNER JOIN #__adsmanager_categories as c ON adcat.catid = c.id " . " LEFT JOIN #__adsmanager_categories as p ON c.parent = p.id " . " WHERE 1 {$globalfilter} AND {$cat_query} c.published = 1 and a.published = 1 GROUP BY a.id {$order_sql} LIMIT 0, {$nbcontents}"; if (function_exists("updateQuery")) { updateQuery($sql); } $this->_db->setQuery($sql); $contents = $this->_db->loadObjectList(); if ($contents == null) { $contents = array(); } foreach ($contents as &$content) { $content->images = @json_decode($content->images); $content->cat = JText::_($content->cat); if ($content->parent != "") { $content->parent = JText::_($content->parent); } if (!is_array($content->images)) { $content->images = array(); } } return $contents; }
public function registerPlugins() { $plugins = TuiyoLoader::model("applications", true); $services = $plugins->getAllSystemPlugins(); $services[] = "system"; //@TODO Crazy way to add the system plugin; $groups = array("timeline" => array(), "profile" => array(), "messages" => array(), "administrator" => array()); foreach ($services as $service) { $timeline = TUIYO_PLUGINS . DS . $service . DS . "events.timeline.php"; $profile = TUIYO_PLUGINS . DS . $service . DS . "events.profile.php"; $messages = TUIYO_PLUGINS . DS . $service . DS . "events.messages.php"; $administrator = TUIYO_PLUGINS . DS . $service . DS . "events.administrator.php"; $authentication = TUIYO_PLUGINS . DS . $service . DS . "events.authentication.php"; //Plugins if (file_exists($timeline)) { $groups["timeline"][$service] = $timeline; } //Profile if (file_exists($profile)) { $groups["profile"][$service] = $profile; } //Administrator if (file_exists($administrator)) { $groups["administrator"][$service] = $administrator; } } $session = JSession::getInstance('none', array()); $session->set("PLUGIN_GROUPS", $groups); $GLOBALS['PLUGIN_GROUPS'] = $groups; }
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); if ($user->id == 0) { TTools::redirectToLogin(TLink::getMyFavoritesLink()); return; } $contentmodel =$this->getModel( "content" ); $catmodel =$this->getModel( "category" ); $positionmodel =$this->getModel( "position" ); $columnmodel =$this->getModel( "column" ); $fieldmodel =$this->getModel( "field" ); $usermodel =$this->getModel( "user" ); $configurationmodel =$this->getModel( "configuration" ); $uri = JFactory::getURI(); $this->requestURL = $uri->toString(); // Get the parameters of the active menu item $menus = $app->getMenu(); $menu = $menus->getActive(); $conf = $configurationmodel->getConfiguration(); jimport( 'joomla.session.session' ); $currentSession = JSession::getInstance('none',array()); $currentSession->set("search_fields",""); $currentSession->set("searchfieldscatid",0); $currentSession->set("searchfieldssql"," 1 "); $currentSession->set("tsearch",""); $filters = array(); $tsearch = JRequest::getVar( 'tsearch', ''); if ($tsearch != "") { $filters['search'] = $tsearch; } $this->assignRef('tsearch',$tsearch); $username = $usermodel->getUser($user->id); $orderfields = $fieldmodel->getOrderFields(0); $this->assignRef('orders',$orderfields); $limitstart = JRequest::getInt("limitstart",0); $limit = $app->getUserStateFromRequest('com_adsmanager.front_ads_per_page','limit',$conf->ads_per_page, 'int'); $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order','order',0,'int'); $orderdir = $app->getUserStateFromRequest('com_adsmanager.front_content.orderid','orderdir','DESC'); $orderdir = strtoupper($orderdir); if (($orderdir != "DESC") && ($orderdir != "ASC")) { $orderdir = "DESC"; } $filter_order = $contentmodel->getFilterOrder($order); $filter_order_dir = $orderdir; $this->assignRef('order',$order); $this->assignRef('orderdir',$orderdir); $total = $contentmodel->getNbContents($filters,0,$user->id); $contents = $contentmodel->getContents($filters,$limitstart, $limit,$filter_order,$filter_order_dir,0,$user->id); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $this->assignRef('pagination',$pagination); $this->assignRef('list_name',$name); $this->assignRef('contents',$contents); $fields = $fieldmodel->getFields(); $this->assignRef('fields',$fields); $this->assignRef('conf',$conf); $this->assignRef('userid',$user->id); $document->setTitle( JText::_('ADSMANAGER_PAGE_FAVORITES')); $field_values = $fieldmodel->getFieldValues(); $plugins = $fieldmodel->getPlugins(); $field = new JHTMLAdsmanagerField($conf,$field_values,'1',$plugins); $this->assignRef('field',$field); $general = new JHTMLAdsmanagerGeneral(0,$conf,$user); $this->assignRef('general',$general); parent::display($tpl); }
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); if ($user->id == 0) { TTools::redirectToLogin("index.php?option=com_adsmanager&view=myads"); return; } $contentmodel =$this->getModel( "content" ); $catmodel =$this->getModel( "category" ); $positionmodel =$this->getModel( "position" ); $columnmodel =$this->getModel( "column" ); $fieldmodel =$this->getModel( "field" ); $usermodel =$this->getModel( "user" ); $configurationmodel =$this->getModel( "configuration" ); $uri = JFactory::getURI(); $this->requestURL = $uri->toString(); // Get the parameters of the active menu item $menus = $app->getMenu(); $menu = $menus->getActive(); $conf = $configurationmodel->getConfiguration(); jimport( 'joomla.session.session' ); $currentSession = JSession::getInstance('none',array()); $currentSession->set("search_fields",""); $currentSession->set("searchfieldscatid",0); $currentSession->set("searchfieldssql"," 1 "); $currentSession->set("tsearch",""); $filters = array(); $filters['user'] = $user->id; $tsearch = JRequest::getVar( 'tsearch', ''); if ($tsearch != "") { $filters['search'] = $tsearch; } $this->assignRef('tsearch',$tsearch); $username = $usermodel->getUser($user->id); if ($conf->display_fullname) { $name = JText::_('ADSMANAGER_LIST_USER_TEXT')." ".$user->name; } else { $name = JText::_('ADSMANAGER_LIST_USER_TEXT')." ".$user->username; } $orderfields = $fieldmodel->getOrderFields(0); $this->assignRef('orders',$orderfields); $limitstart = JRequest::getInt("limitstart",0); $limit = $app->getUserStateFromRequest('com_adsmanager.front_ads_per_page','limit',$conf->ads_per_page, 'int'); $order = $app->getUserStateFromRequest('com_adsmanager.front_content.order','order',0,'int'); $orderdir = $app->getUserStateFromRequest('com_adsmanager.front_content.orderid','orderdir','DESC'); $orderdir = strtoupper($orderdir); if (($orderdir != "DESC") && ($orderdir != "ASC")) { $orderdir = "DESC"; } $filter_order = $contentmodel->getFilterOrder($order); $filter_order_dir = $orderdir; $this->assignRef('order',$order); $this->assignRef('orderdir',$orderdir); $rootid = JRequest::getInt('rootid',0); $filters['rootid'] = $rootid; $total = $contentmodel->getNbContents($filters,1); $contents = $contentmodel->getContents($filters,$limitstart, $limit,$filter_order,$filter_order_dir,1); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $this->assignRef('pagination',$pagination); $this->assignRef('list_name',$name); $this->assignRef('contents',$contents); $fields = $fieldmodel->getFields(); $this->assignRef('fields',$fields); $this->assignRef('conf',$conf); $this->assignRef('userid',$user->id); $document->setTitle( JText::_('ADSMANAGER_PAGE_MY_ADS')); $field_values = $fieldmodel->getFieldValues(); $plugins = $fieldmodel->getPlugins(); $field = new JHTMLAdsmanagerField($conf,$field_values,'1',$plugins); $this->assignRef('field',$field); $general = new JHTMLAdsmanagerGeneral(0,$conf,$user); $this->assignRef('general',$general); if (PAIDSYSTEM == 1) { require_once(JPATH_ROOT.'/administrator/components/com_paidsystem/models/top.php'); $topmodel = new PaidsystemModelTop(); $tops = $topmodel->getTops(); $topoption = null; foreach($tops as $t) { if ($t->duration == 1) { $topoption = $t; break; } } $this->assignRef('topoption',$topoption); } parent::display($tpl); }
<?php defined('_JEXEC') or die ('Direct Access is not allowed'); $host = JURI::root(); $document = JFactory::getDocument(); $session = JSession::getInstance("none",array()); $ses=$session->getId(); if(!function_exists("freichatx_get_hash")){ function freichatx_get_hash($ses){ if(is_file(JPATH_SITE."/freichat/hardcode.php")){ require(JPATH_SITE.'/freichat/hardcode.php'); $temp_id = $ses . $uid; return md5($temp_id); } else { echo "<script>alert('module freichatx says: arg.php file not found!');</script>"; } return 0; } }
/** * Allows the application to load a custom or default session. * * The logic and options for creating this object are adequately generic for default cases * but for many applications it will make sense to override this method and create a session, * if required, based on more specific needs. * * @param JSession $session An optional session object. If omitted, the session is created. * * @return InstallationApplicationWeb This method is chainable. * * @since 3.1 */ public function loadSession(JSession $session = null) { // 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, 'force_ssl' => $this->get('force_ssl')); // Instantiate the session object. $session = JSession::getInstance($handler, $options); $session->initialise($this->input, $this->dispatcher); if ($session->getState() == 'expired') { $session->restart(); } else { $session->start(); } if (!$session->get('registry') instanceof Registry) { // Registry has been corrupted somehow. $session->set('registry', new Registry('session')); } // Set the session object. $this->session = $session; // Register the session with JFactory. JFactory::$session = $session; return $this; }
public function display($tpl = null) { $app = JFactory::getApplication(); $redTemplate = new Redtemplate(); $lists = array(); $uri = JFactory::getURI(); $params = $app->getParams('com_redshop'); $document = JFactory::getDocument(); $layout = JRequest::getCmd('layout', ''); $model = $this->getModel('search'); if ($layout == 'default') { $pagetitle = JText::_('COM_REDSHOP_SEARCH'); $document->setTitle($pagetitle); } $document = JFactory::getDocument(); JHTML::Script('common.js', 'components/com_redshop/assets/js/', false); if (AJAX_CART_BOX == 0) { JHTML::Script('fetchscript.js', 'components/com_redshop/assets/js/', false); JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false); } // Ajax cart javascript if (AJAX_CART_BOX == 1) { JHTML::Script('fetchscript.js', 'components/com_redshop/assets/js/', false); JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false); JHTML::Stylesheet('fetchscript.css', 'components/com_redshop/assets/css/'); } if ($layout == 'redfilter') { $session = JSession::getInstance('none', array()); $tagid = JRequest::getInt('tagid', 0); $typeid = JRequest::getInt('typeid', 0); $remove = JRequest::getInt('remove', 0); $Itemid = JRequest::getInt('Itemid', 0); $cntproduct = JRequest::getInt('cnt', 0); $getredfilter = $session->get('redfilter'); if (count($getredfilter) == 0) { $redfilter = array(); } else { $redfilter = $getredfilter; } if ($tagid != 0 && $typeid != 0 && !array_key_exists($typeid, $redfilter)) { $redfilter[$typeid] = $tagid; } if ($remove == 1) { if ($typeid != 0) { unset($redfilter[$typeid]); $session->set('redfilter', $redfilter); $this->setLayout('redfilter'); $model->getRedFilterProduct($remove); echo $model->mod_redProductfilter($Itemid, $typeid) . '~'; } else { $session->destroy('redfilter'); } } $session->set('redfilter', $redfilter); if ($cntproduct == 1) { $mypid = JRequest::getInt('pid', 0); $app->Redirect('index.php?option=com_redshop&view=product&pid=' . $mypid . '&Itemid=' . $Itemid); } } $redHelper = new redhelper(); $order_data = $redHelper->getOrderByList(); $getorderby = JRequest::getString('order_by', DEFAULT_PRODUCT_ORDERING_METHOD); $lists['order_select'] = JHTML::_('select.genericlist', $order_data, 'order_by', 'class="inputbox" size="1" onchange="document.orderby_form.submit();" ', 'value', 'text', $getorderby); $templatedata = $model->getCategoryTemplet(); for ($i = 0; $i < 1; $i++) { $templatedata[$i]->template_desc = $redTemplate->readtemplateFile($templatedata[$i]->template_section, $templatedata[$i]->template_name); } $search = $this->get('Data'); $pagination = $this->get('Pagination'); $this->params = $params; $this->limit = $model->getState('limit'); $this->lists = $lists; $this->templatedata = $templatedata; $this->search = $search; $this->pagination = $pagination; $this->request_url = $uri->toString(); parent::display($tpl); }
/** * Create a session object * * @param array $options An array containing session options * * @return JSession object * * @since 11.1 */ protected static function createSession(array $options = array()) { // Get the editor configuration setting $conf = self::getConfig(); $handler = $conf->get('session_handler', 'none'); // Config time is in minutes $options['expire'] = $conf->get('lifetime') ? $conf->get('lifetime') * 60 : 900; $session = JSession::getInstance($handler, $options); if ($session->getState() == 'expired') { $session->restart(); } return $session; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { include_once JPATH_BASE . '/libraries/joomla/session/session.php'; include_once JPATH_BASE . '/libraries/joomla/application/application.php'; $this->object = JSession::getInstance('none', array('expire' => 20, 'force_ssl' => true, 'name' => 'name', 'id' => 'id', 'security' => 'security')); }
/** * Allows the application to load a custom or default session. * * The logic and options for creating this object are adequately generic for default cases * but for many applications it will make sense to override this method and create a session, * if required, based on more specific needs. * * @param JSession $session An optional session object. If omitted, the session is created. * * @return JApplicationWeb This method is chainable. * * @since 11.3 */ 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('sess_lifetime') ? $this->get('sess_lifetime') * 60 : 900; // Get the session handler from the configuration. $handler = $this->get('sess_handler', 'none'); // Initialize the options for JSession. $options = array('name' => $name, 'expire' => $lifetime, 'force_ssl' => $this->get('force_ssl')); // Instantiate the session object. $session = JSession::getInstance($handler, $options); $session->initialise($this->input); if ($session->getState() == 'expired') { $session->restart(); } // If the session is new, load the user and registry objects. if ($session->isNew()) { $session->set('registry', new JRegistry()); $session->set('user', new JUser()); } // Set the session object. $this->session = $session; return $this; }
/** * JAVA Upload * */ function Joom_ShowJUpload() { $config = Joom_getConfig(); $database =& JFactory::getDBO(); $user =& JFactory::getUser(); $mainframe =& JFactory::getApplication('administrator'); //check the php.ini setting 'session.cookie_httponly' //if set and = 1 then build the parameter 'readCookieFrom Navigator=false' //in Applet (new since V 4.2.1c) //and provide the cookie with sessionname=token in parameter 'specificHeaders' $cookieNavigator = true; $sesscook = @ini_get('session.cookie_httponly'); if (!empty($sesscook) && $sesscook == 1) { $cookieNavigator = false; //get the actual session $currentSession = JSession::getInstance('', array()); $this->sessionname = $currentSession->getName(); //function getToken() delivers wrong token, so get the right one //from $_COOKIE array (since PHP 4.1.0) $this->sessiontoken = $_COOKIE[$this->sessionname]; } HTML_Joom_AdminUploads::Joom_ShowJUpload_HTML($cookieNavigator); }