예제 #1
0
 /**
  * Display module content
  *
  * @return  void
  */
 public function display()
 {
     $this->verified = 0;
     if (!User::isGuest()) {
         $profile = Profile::getInstance(User::get('id'));
         if ($profile->get('emailConfirmed') == 1 || $profile->get('emailConfirmed') == 3) {
             $this->verified = 1;
         }
     }
     // Figure out whether this is a guess or temporary account created during the auth_link registration process
     if (User::isGuest() || is_numeric(User::get('username')) && User::get('username') < 0) {
         $this->guestOrTmpAccount = true;
     } else {
         $this->guestOrTmpAccount = false;
     }
     $this->referrer = Request::getVar('REQUEST_URI', '', 'server');
     $this->referrer = str_replace('&amp;', '&', $this->referrer);
     $this->referrer = base64_encode($this->referrer);
     $browser = new Detector();
     $this->os = $browser->platform();
     $this->os_version = $browser->platformVersion();
     $this->browser = $browser->name();
     $this->browser_ver = $browser->version();
     $this->css()->js()->js('jQuery(document).ready(function(jq) { HUB.Modules.ReportProblems.initialize("' . $this->params->get('trigger', '#tab') . '"); });');
     $this->supportParams = Component::params('com_support');
     require $this->getLayoutPath();
 }
예제 #2
0
 /**
  * Tests the match() method.
  *
  * @covers  \Hubzero\Browser\Detector::match
  * @return  void
  **/
 public function testMatch()
 {
     $uas = UserAgentStringMapper::map();
     foreach ($uas as $userAgentString) {
         $browser = new Detector($userAgentString->getString());
         $this->assertEquals(strtolower($userAgentString->getBrowser()), $browser->name());
         $this->assertEquals($userAgentString->getBrowserVersion(), $browser->version());
         $this->assertEquals($userAgentString->getOs(), $browser->platform());
     }
 }
예제 #3
0
 /**
  * Tests the match() method.
  *
  * @covers  \Hubzero\Browser\Detector::match
  * @return  void
  **/
 public function testMatch()
 {
     $uas = self::map();
     foreach ($uas as $userAgentString) {
         $browser = new Detector($userAgentString->string);
         $this->assertEquals($userAgentString->string, $browser->agent());
         $this->assertEquals(strtolower($userAgentString->browser), $browser->name());
         $this->assertEquals($userAgentString->browserVersion, $browser->version());
         $this->assertEquals($userAgentString->os, $browser->platform());
     }
 }
예제 #4
0
 /**
  * Displays a ticket and comments
  *
  * @param   mixed  $comment
  * @return  void
  */
 public function editTask($comment = null)
 {
     Request::setVar('hidemainmenu', 1);
     $layout = 'edit';
     // Incoming
     $id = Request::getInt('id', 0);
     // Initiate database class and load info
     $row = Ticket::getInstance($id);
     // Editing or creating a ticket?
     if (!$row->exists()) {
         $layout = 'add';
         // Creating a new ticket
         $row->set('severity', 'normal');
         $row->set('status', 0);
         $row->set('created', Date::toSql());
         $row->set('login', User::get('username'));
         $row->set('name', User::get('name'));
         $row->set('email', User::get('email'));
         $row->set('cookies', 1);
         $browser = new \Hubzero\Browser\Detector();
         $row->set('os', $browser->platform() . ' ' . $browser->platformVersion());
         $row->set('browser', $browser->name() . ' ' . $browser->version());
         $row->set('uas', Request::getVar('HTTP_USER_AGENT', '', 'server'));
         $row->set('ip', Request::ip());
         $row->set('hostname', gethostbyaddr(Request::getVar('REMOTE_ADDR', '', 'server')));
         $row->set('section', 1);
     }
     $this->view->filters = Utilities::getFilters();
     $this->view->lists = array();
     // Get messages
     $sm = new Tables\Message($this->database);
     $this->view->lists['messages'] = $sm->getMessages();
     // Get categories
     $sa = new Tables\Category($this->database);
     $this->view->lists['categories'] = $sa->find('list');
     // Get severities
     $this->view->lists['severities'] = Utilities::getSeverities($this->config->get('severities'));
     if (trim($row->get('group'))) {
         $this->view->lists['owner'] = $this->_userSelectGroup('owner', $row->get('owner'), 1, '', trim($row->get('group')));
     } elseif (trim($this->config->get('group'))) {
         $this->view->lists['owner'] = $this->_userSelectGroup('owner', $row->get('owner'), 1, '', trim($this->config->get('group')));
     } else {
         $this->view->lists['owner'] = $this->_userSelect('owner', $row->get('owner'), 1);
     }
     $this->view->row = $row;
     if ($watch = Request::getWord('watch', '')) {
         $watch = strtolower($watch);
         // Already watching
         if ($this->view->row->isWatching(User::getInstance())) {
             // Stop watching?
             if ($watch == 'stop') {
                 $this->view->row->stopWatching(User::getInstance());
             }
         } else {
             // Start watching?
             if ($watch == 'start') {
                 $this->view->row->watch(User::getInstance());
                 if (!$this->view->row->isWatching(User::getInstance(), true)) {
                     $this->setError(Lang::txt('COM_SUPPORT_ERROR_FAILED_TO_WATCH'));
                 }
             }
         }
     }
     if (!$comment) {
         $comment = new Comment();
     }
     $this->view->comment = $comment;
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Output the HTML
     $this->view->set('config', $this->config)->setLayout($layout)->display();
 }
예제 #5
0
 /**
  * Displays a form for creating a new support ticket
  *
  * @return  void
  */
 public function newTask($row = null)
 {
     if (!$row instanceof Ticket) {
         $row = new Ticket();
         $row->set('open', 1)->set('status', 0)->set('ip', Request::ip())->set('uas', Request::getVar('HTTP_USER_AGENT', '', 'server'))->set('referrer', base64_encode(Request::getVar('HTTP_REFERER', NULL, 'server')))->set('cookies', Request::getVar('sessioncookie', '', 'cookie') ? 1 : 0)->set('instances', 1)->set('section', 1)->set('tool', Request::getVar('tool', ''))->set('verified', 0);
         if ($referrer = Request::getVar('referrer')) {
             $row->set('referrer', base64_encode($referrer));
         }
         if (!User::isGuest()) {
             $row->set('name', User::get('name'));
             $row->set('login', User::get('username'));
             $row->set('email', User::get('email'));
         }
     }
     $browser = new Detector();
     $row->set('os', $browser->platform())->set('osver', $browser->platformVersion())->set('browser', $browser->name())->set('browserver', $browser->version());
     if (!User::isGuest()) {
         $emailConfirmed = User::get('activation');
         if ($emailConfirmed == 1 || $emailConfirmed == 3) {
             $row->set('verified', 1);
         }
     }
     // Output HTML
     $lists = array();
     if ($row->get('verified') && $this->acl->check('update', 'tickets') > 0) {
         if (trim($this->config->get('group'))) {
             $lists['owner'] = $this->_userSelectGroup('problem[owner]', '', 1, '', trim($this->config->get('group')));
         } else {
             $lists['owner'] = $this->_userSelect('problem[owner]', '', 1);
         }
         $lists['severities'] = Utilities::getSeverities($this->config->get('severities'));
         $sc = new Tables\Category($this->database);
         $lists['categories'] = $sc->find('list');
     }
     // Set page title
     $this->_buildTitle();
     // Set the pathway
     $this->_buildPathway();
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $this->view->set('acl', $this->acl)->set('title', $this->_title)->set('file_types', $this->config->get('file_ext'))->set('lists', $lists)->set('row', $row)->set('captchas', Event::trigger('support.onGetComponentCaptcha'))->setLayout('new')->display();
 }