preg_match('/[^-]+$/', $document->getTitle(), $match); $communityController = new CommunityController(); $groups = $communityController->getModel('Groups', 'CommunityAdminModel'); $reports = $communityController->getModel('Reports'); $mailque = $communityController->getModel('MailQueue'); $events = $communityController->getModel('Events'); $users = $communityController->getModel('Users'); /*Optimize query*/ $unsendMail = $mailque->getUnsendMail(); $pendingGroup = $groups->getPendingGroups(); $pendingEvent = $events->getPendingEvents(); $pendingReport = $reports->getPendingCount(); $pendingUser = $users->getPendingMember(); $view = $communityController->getView('community', 'html'); $stableVersion = $communityController->_getCurrentVersionData(); $localVersion = $communityController->_getLocalVersionNumber(); $isLatest = version_compare($localVersion, $stableVersion->version, '<'); $total = $isLatest ? 1 : 0; $version = $isLatest ? $stableVersion->version : 0; $total = $pendingGroup + $pendingEvent + $pendingReport + $pendingUser + $unsendMail; $versionUrl = ''; $my = CFactory::getUser(); if (JFile::exists(JPATH_ROOT . '/administrator/components/com_ijoomlainstaller/ijoomlainstaller.xml')) { $versionUrl = JRoute::_('index.php?option=com_ijoomlainstaller'); } $view->set('pageTitle', $match[0]); $view->set('pageContent', $out); $view->set('pendingGroup', $pendingGroup); $view->set('pendingEvent', $pendingEvent); $view->set('reportCount', $pendingReport); $view->set('pendingUser', $pendingUser);
public function ajaxCheckVersion() { $response = new JAXResponse(); $communityController = new CommunityController(); $stableVersion = $communityController->_getCurrentVersionData(); $localVersion = $communityController->_getLocalVersionNumber(); $data = $this->_getCurrentVersionData(); //this is only used to get the links for change log and update instructions ob_start(); if ($stableVersion) { // Test versions if (version_compare($localVersion, $stableVersion->version, '<')) { ?> <h5><?php echo JText::_('COM_COMMUNITY_UPDATE_SUMMARY'); ?> </h5> <div style="color: red"><?php echo JText::_('COM_COMMUNITY_OLDER_VERSION_OF_JOM_SOCIAL'); ?> </div> <div><?php echo JText::sprintf('Version installed: <span style="font-weight:700; color: red">%1$s</span>', $this->_getLocalVersionString()); ?> </div> <div><?php echo JText::sprintf('Latest version available: <span style="font-weight:700;">%1$s</span>', $stableVersion->version); ?> </div> <div><?php echo JText::sprintf('View full changelog at <a href="%1$s" target="_blank">%2$s</a>', $data->changelogURL, $data->changelogURL); ?> </div> <div><?php echo JText::sprintf('View the upgrade instructions at <a href="%1$s" target="_blank">%2$s</a>', $data->instructionURL, $data->instructionURL); ?> </div> <?php } else { ?> <div class="clearfix"> <h5><?php echo JText::_('COM_COMMUNITY_UPDATE_SUMMARY'); ?> </h5> <div><?php echo JText::_('COM_COMMUNITY_LATEST_VERSION_OF_JOM_SOCIAL'); ?> </div> <div><?php echo JText::sprintf('Version installed: <span style="font-weight:700;">%1$s</span>', $this->_getLocalVersionString()); ?> </div> </div> <?php } } else { ?> <div style="color: red"><?php echo JText::_('Please enable "allow_url_fopen" to check version'); ?> </div> <?php } $contents = ob_get_contents(); ob_end_clean(); $response->addAssign('cWindowContent', 'innerHTML', $contents); $action = '<input type="button" class="btn btn-small pull-right" onclick="cWindowHide();" name="' . JText::_('COM_COMMUNITY_CLOSE') . '" value="' . JText::_('COM_COMMUNITY_CLOSE') . '" />'; $response->addScriptCall('cWindowActions', $action); return $response->sendResponse(); }