Exemplo n.º 1
0
 static function _($url, $xhtml = false, $ssl = null, $d = false)
 {
     // skip any external urls
     if (strpos($url, "option") !== false && strpos($url, "option=com_fss") === false) {
         return JRoute::_($url, $xhtml, $ssl);
     }
     global $FSSRoute_debug;
     global $FSSRoute_menus;
     global $FSSRoute_access;
     self::$d = $d;
     // get any menu items for fss
     FSS_Helper::GetRouteMenus();
     // Get the router
     $router = JFactory::getApplication()->getRouter();
     // if the url dont start with index.php, we need to add the exisitng url to what we want
     if (substr($url, 0, 9) != "index.php") {
         //echo "Making FUll URL: $url<br>";
         $url = self::_fullURL($router, $url);
         //echo "Resut : $url<br>";
     }
     $uri = new JURI($url);
     // work out is we are in an Itemid already, if so, set it as the best match
     if ($uri->hasVar('Itemid')) {
         $bestmatch = $uri->getVar('Itemid');
     } else {
         $bestmatch = '';
     }
     $bestcount = 0;
     $uriquery = $uri->toString(array('query'));
     $urivars = FSSRoute::SplitURL($uriquery);
     $sourcevars = FSSRoute::SplitURL($url);
     // check through the menu item for the current url, and add any items to the new url that are missing
     if ($bestmatch && array_key_exists($bestmatch, $FSSRoute_menus)) {
         foreach ($FSSRoute_menus[$bestmatch] as $key => $value) {
             if (!array_key_exists($key, $urivars) && !array_key_exists($key, $sourcevars)) {
                 $urivars[$key] = $value;
             }
         }
     }
     $current_access = 0;
     if (array_key_exists(FSS_Input::getInt('Itemid'), $FSSRoute_access)) {
         $current_access = $FSSRoute_access[FSS_Input::getInt('Itemid')];
     }
     if ($d) {
         echo "Incoming Link : {$url}<br>";
         echo "Cur Item ID : " . FSS_Input::getInt('Itemid') . "<br>";
         //print_p($FSSRoute_menus);
     }
     foreach ($FSSRoute_menus as $id => $vars) {
         if ($d) {
             echo "{$id} => <Br>";
             print_p($vars);
         }
         // need to check if the access level is the same
         if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
             if ($d) {
                 echo "No Access<br>";
             }
             continue;
         }
         $count = FSSRoute::MatchVars($urivars, $vars);
         if (FSS_Input::getInt('Itemid') == $id && $count > 0) {
             if ($d) {
                 echo "Current ItemId: increase count<br>";
             }
             $count++;
         }
         if ($d) {
             echo "Count: {$count}<br>";
         }
         if ($count > $bestcount) {
             if ($d) {
                 echo "New best match - {$id}<br>";
             }
             $bestcount = $count;
             $bestmatch = $id;
         }
     }
     if ($bestcount == 0 && array_key_exists('view', $sourcevars) && substr($sourcevars['view'], 0, 6) == "admin_") {
         foreach ($FSSRoute_menus as $id => $item) {
             // need to check if the access level is the same
             if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
                 continue;
             }
             if ($item['view'] == "admin") {
                 $bestcount = 1;
                 $bestmatch = $id;
             }
         }
     }
     // no match found, try to fallback on the main support menu id
     if ($bestcount == 0) {
         foreach ($FSSRoute_menus as $id => $item) {
             // need to check if the access level is the same
             if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
                 continue;
             }
             if ($item['view'] == "main") {
                 $bestcount = 1;
                 $bestmatch = $id;
             }
         }
     }
     if ($bestcount == 0) {
         // still no match found, use any fss menu
         if (count($FSSRoute_menus) > 0) {
             foreach ($FSSRoute_menus as $id => $item) {
                 // need to check if the access level is the same
                 if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
                     continue;
                 }
                 $bestcount = 1;
                 $bestmatch = $id;
                 break;
             }
         }
     }
     if ($d) {
         echo "Best Found : {$bestcount}, {$bestmatch}<br>";
     }
     // sticky menu items
     if (FSS_Settings::get('sticky_menus_type')) {
         $cur_item_id = FSS_Input::GetInt("Itemid");
         if ($cur_item_id > 0) {
             $sticky_ids = explode(";", FSS_Settings::get('sticky_menus'));
             if (FSS_Settings::get('sticky_menus_type') == 1 && in_array($cur_item_id, $sticky_ids) || FSS_Settings::get('sticky_menus_type') == 2 && !in_array($cur_item_id, $sticky_ids)) {
                 $bestcount = 0;
                 $uri->setVar('Itemid', $cur_item_id);
             }
         }
     }
     if ($bestcount > 0) {
         $uri->setVar('Itemid', $bestmatch);
         // we need to remove parameters that are in the main url as well as the sub one
         // wait till 2.2 for this change as it may break stuff
     }
     if ($d) {
         echo "Using : " . $uri->toString(array('path', 'query', 'fragment')) . "<br>";
     }
     return JRoute::_($uri->toString(array('path', 'query', 'fragment')), $xhtml, $ssl);
 }
Exemplo n.º 2
0
        ?>
					<?php 
        if ($cat['section'] != $sect && $cat['section'] != "") {
            if ($open) {
                echo "</optgroup>";
            }
            $open = true;
            echo "<optgroup label='" . $cat['section'] . "'>";
            $sect = $cat['section'];
        }
        ?>
					<option value='<?php 
        echo $cat['id'];
        ?>
' <?php 
        if (FSS_Input::GetInt('catid') == $cat['id']) {
            echo "selected='selected'";
        }
        ?>
><?php 
        echo $cat['title'];
        ?>
</option>
				<?php 
    }
    ?>
				<?php 
    if ($open) {
        echo "</optgroup>";
    }
    ?>
Exemplo n.º 3
0
 function display($tpl = null)
 {
     $autologin = FSS_Input::getCmd('login');
     if ($autologin != "") {
         FSS_Helper::AutoLogin($autologin);
     }
     if (!FSS_Permission::auth("fss.ticket.view", "com_fss.support_user") && !FSS_Permission::auth("fss.ticket.open", "com_fss.support_user")) {
         return FSS_Helper::NoPerm();
     }
     $session = JFactory::getSession();
     $user = JFactory::getUser();
     $this->userid = $user->get('id');
     $this->ticket = null;
     $this->assign('tmpl', '');
     $what = FSS_Input::getCmd('what');
     $layout = FSS_Input::getCmd('layout');
     $this->ticket_view = FSS_Input::getCmd('tickets');
     if (!$this->ticket_view && FSS_Settings::get('support_simple_userlist_tabs')) {
         $this->ticket_view = "all";
     }
     // reset the login and password
     if ($what == "reset") {
         $session->clear('ticket_email');
         $session->clear('ticket_reference');
         $session->clear('ticket_name');
         $session->clear('ticket_pass');
     }
     if ($what == "unreg_passlist") {
         return $this->Unreg_Passlist();
     }
     if ($what == "addccuser") {
         return $this->AddCCUser();
     }
     if ($what == "removeccuser") {
         return $this->RemoveCCUser();
     }
     if ($what == "pickccuser") {
         return $this->PickCCUser();
     }
     // should we display the edit field screen
     if ($what == 'editfield') {
         return $this->EditField();
     }
     // save an edited field and continue what we were doing afterwards
     if ($what == 'savefield') {
         if ($this->SaveField()) {
             return;
         }
     }
     FSS_Helper::AddSCEditor();
     // check for product search ajax display
     if (FSS_Input::getString('prodsearch') != "") {
         return $this->searchProducts();
     }
     if (FSS_Input::getString('deptsearch') != "") {
         return $this->searchDepartments();
     }
     // page to hunt for unregistered ticket
     if ($what == "find") {
         return $this->findTicket();
     }
     // save status changes
     if ($what == "statuschange") {
         return $this->saveStatusChanges();
     }
     // save any replys
     if ($what == 'savereply') {
         return $this->saveReply();
     }
     // save any replys
     if ($what == 'messages') {
         return $this->showMessages();
     }
     // process any file downloads
     $fileid = FSS_Input::getInt('fileid');
     if ($fileid > 0) {
         $ticketid = FSS_Input::GetInt('ticketid');
         if ($what == 'attach_thumb') {
             return SupportHelper::attachThumbnail($ticketid, $fileid, true);
         } else {
             return SupportHelper::attachDownload($ticketid, $fileid, true);
         }
     }
     $this->count = $this->get('TicketCount');
     // handle opening ticket
     if ($layout == "open") {
         return $this->doOpenTicket();
     }
     // handel ticket reply
     if ($layout == "reply") {
         return $this->doUserReply();
     }
     // display ticket list / ticket
     return $this->doDisplayTicket();
 }