/** * Downloads a package * * @param string $url URL of file to download * @param string $target Download target filename [optional] * * @return mixed Path to downloaded package or boolean false on failure * * @since 11.1 */ public static function downloadPackage($url, $target = false) { $config = JFactory::getConfig(); // Capture PHP errors $track_errors = ini_get('track_errors'); ini_set('track_errors', true); // Set user agent $version = new JVersion(); ini_set('user_agent', $version->getUserAgent('Installer')); $http = JHttpFactory::getHttp(); $response = $http->get($url); if (200 != $response->code) { JLog::add(JText::_('JLIB_INSTALLER_ERROR_DOWNLOAD_SERVER_CONNECT'), JLog::WARNING, 'jerror'); return false; } if ($response->headers['wrapper_data']['Content-Disposition']) { $contentfilename = explode("\"", $response->headers['wrapper_data']['Content-Disposition']); $target = $contentfilename[1]; } // Set the target path if not given if (!$target) { $target = $config->get('tmp_path') . '/' . self::getFilenameFromURL($url); } else { $target = $config->get('tmp_path') . '/' . basename($target); } // Write buffer to file JFile::write($target, $response->body); // Restore error tracking to what it was before ini_set('track_errors', $track_errors); // Bump the max execution time because not using built in php zip libs are slow @set_time_limit(ini_get('max_execution_time')); // Return the name of the downloaded package return basename($target); }
public function delete() { // Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); // Get items to remove from the request. $cid = JFactory::getApplication()->input->get('cid', array(), 'array'); if (!is_array($cid) || count($cid) < 1) { JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror'); } else { // Get the model. $model = $this->getModel(); // Make sure the item ids are integers jimport('joomla.utilities.arrayhelper'); JArrayHelper::toInteger($cid); // Remove the items. if ($model->delete($cid)) { $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); } else { $this->setMessage($model->getError()); } } $version = new JVersion(); if ($version->isCompatible('3.0')) { // Invoke the postDelete method to allow for the child class to access the model. $this->postDeleteHook($model, $cid); } $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $html = ''; $minversion = $this->element['minversion']; $downloadlink = $this->element['downloadlink']; $version = new JVersion(); $jversion = explode('.', $version->getShortVersion()); $class = ''; $style = ''; if (intval($jversion[0]) > 2) { $class = 'alert alert-warning'; } else { $style = 'margin: 5px 0; padding: 8px 35px 8px 14px; border-radius: 4px; border: 1px solid #FBEED5; background-color: #FCF8E3; color: #C09853;'; } if (!JFolder::exists(JPATH_ROOT . '/libraries/syw')) { $html .= '<div class="' . $class . '" style="' . $style . '">'; $html .= ' <span>' . JText::_('SYW_MISSING_SYWLIBRARY') . '</span><br />'; $html .= ' <a href="' . $downloadlink . '" target="_blank">' . JText::_('SYW_DOWNLOAD_SYWLIBRARY') . '</a>'; $html .= '</div>'; } else { jimport('syw.version'); if (!SYWVersion::isCompatible($minversion)) { $html .= '<div class="' . $class . '" style="' . $style . '">'; $html .= ' <span>' . JText::_('SYW_NONCOMPATIBLE_SYWLIBRARY') . '</span><br />'; $html .= ' <span>' . JText::_('SYW_UPDATE_SYWLIBRARY') . JText::_('SYW_OR') . '</span>'; $html .= ' <a href="' . $downloadlink . '" target="_blank">' . strtolower(JText::_('SYW_DOWNLOAD_SYWLIBRARY')) . '</a>'; $html .= '</div>'; } } return $html; }
public function preflight($type, $parent) { if ($type == 'uninstall') { return true; } try { $source = $parent->getParent()->getPath('source'); $jversion = new JVersion(); if (!$jversion->isCompatible('2.5.5')) { throw new Exception('Please upgrade to at least Joomla! 2.5.5 before continuing!'); } if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/rsform.php')) { throw new Exception('Please install the RSForm! Pro component before continuing.'); } if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/version.php')) { throw new Exception('Please upgrade RSForm! Pro to at least R45 before continuing!'); } // Copy needed files $this->copyFiles($source); // Update? Run our SQL file if ($type == 'update') { $this->runSQL($source, 'install'); } } catch (Exception $e) { JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } return true; }
public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->categories = Djc2Categories::getInstance(); $user = JFactory::getUser(); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->ordering = array(); foreach ($this->items as &$item) { if (!isset($this->ordering[$item->parent_id])) { $this->ordering[$item->parent_id] = array(); } $this->ordering[$item->parent_id][] = $item->id; } $this->addToolbar(); if (class_exists('JHtmlSidebar') && $user->authorise('core.admin')) { $this->sidebar = JHtmlSidebar::render(); } $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0.0', '<')) { $tpl = 'legacy'; } parent::display($tpl); }
function com_uninstall() { jimport('joomla.filesystem.file'); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '1.6', '>=')) { $db = JFactory::getDBO(); $db->setQuery("Delete From #__menu Where `link` Like 'index.php?option=com_breezingforms&act=%'"); $db->query(); $db->setQuery("Delete From #__menu Where `alias` Like 'BreezingForms' And `path` Like 'breezingforms'"); $db->query(); } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'breezingforms' . DS . 'facileforms.config.php')) { JFile::delete(JPATH_SITE . DS . 'media' . DS . 'breezingforms' . DS . 'facileforms.config.php'); } if (JFile::exists(JPATH_SITE . "/components/com_sh404sef/sef_ext/com_breezingforms.php")) { JFile::delete(JPATH_SITE . "/components/com_sh404sef/sef_ext/com_breezingforms.php"); } if (JFile::exists(JPATH_SITE . '/ff_secimage.php')) { JFile::delete(JPATH_SITE . '/ff_secimage.php'); } if (JFile::exists(JPATH_SITE . '/templates/system/ff_secimage.php')) { JFile::delete(JPATH_SITE . '/templates/system/ff_secimage.php'); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/breezingforms_elements.xml")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/breezingforms_elements.xml"); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformFilter.php")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformFilter.php"); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformoptions_emptyFilter.php")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformoptions_emptyFilter.php"); } }
function com_install() { if (defined('_JEXEC') && class_exists('JApplication')) { $config = JFactory::getConfig(); $config->setValue('config.live_site', substr_replace(JURI::root(), '', -1, 1)); $url = JURI::root() . 'administrator/index.php?option=com_jcomments&task=postinstall'; $version = new JVersion(); if (version_compare('1.6.0', $version->getShortVersion()) > 0) { require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'language.php'; JCommentsInstallerLanguageHelper::convertLanguages15(); } } else { global $mainframe; $componentPath = $mainframe->getCfg('absolute_path') . DS . 'components' . DS . 'com_jcomments'; require_once $componentPath . DS . 'libraries' . DS . 'joomlatune' . DS . 'filesystem.php'; require_once $componentPath . DS . 'jcomments.legacy.php'; require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'installer.php'; JCommentsInstallerHelper::extractJCommentsLibraryConvert(); if (is_file($componentPath . DS . 'libraries' . DS . 'convert' . DS . 'utf8.class.php')) { require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'language.php'; JCommentsInstallerLanguageHelper::convertLanguages10(); } $url = $mainframe->getCfg('live_site') . '/administrator/index2.php?option=com_jcomments&task=postinstall'; } if (headers_sent()) { echo '<script type="text/javascript">document.location.href="' . $url . '";</script>'; } else { header('Location: ' . $url); } }
/** * Display the view * * @access public */ function display($tpl = null) { $app = JFactory::getApplication(); $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); $version = new JVersion(); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } JHTML::stylesheet('administrator/components/com_xmap/css/xmap.css'); // Convert dates from UTC $offset = $app->getCfg('offset'); if (intval($this->item->created)) { $this->item->created = JHtml::date($this->item->created, '%Y-%m-%d %H-%M-%S', $offset); } $this->_setToolbar(); if (version_compare($version->getShortVersion(), '3.0.0', '<')) { $tpl = 'legacy'; } parent::display($tpl); JRequest::setVar('hidemainmenu', true); }
function preflight($type, $parent) { $jversion = new JVersion(); // Installing component manifest file version $this->release = $parent->get("manifest")->version; // Manifest file minimum Joomla version $this->minimum_joomla_release = $parent->get("manifest")->attributes()->version; // Show the essential information at the install/update back-end echo '<p>Installing component manifest file version = ' . $this->release; echo '<br />Current manifest cache commponent version (if any) = ' . $this->getParam('version'); echo '<br />Installing component manifest file minimum Joomla version = ' . $this->minimum_joomla_release; echo '<br />Current Joomla version = ' . $jversion->getShortVersion(); // abort if the current Joomla release is older if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) { Jerror::raiseWarning(null, 'Cannot install com_improvemycity in a Joomla release prior to ' . $this->minimum_joomla_release); return false; } // abort if the component being installed is not newer than the currently installed version if ($type == 'update') { $oldRelease = $this->getParam('version'); $rel = $oldRelease . ' to ' . $this->release; if (version_compare($this->release, $oldRelease, 'lt')) { Jerror::raiseWarning(null, 'Incorrect version sequence. Cannot upgrade ' . $rel); return false; } } else { $rel = $this->release; } //echo '<p>' . JText::_('COM_IMPROVEMYCITY_PREFLIGHT_' . $type . ' ' . $rel) . '</p>'; }
function __construct() { parent::__construct(); // Load the database and execute our sql file $this->db = JFactory::getDBO(); // Get information of our plugin so we can pass it on to MDS Collivery for Logs $sel_query = "SELECT * FROM `#__extensions` where type = 'plugin' and element = 'mds_shipping' and folder = 'vmshipment';"; $this->db->setQuery($sel_query); $this->db->query(); $this->extension_id = $this->db->loadObjectList()[0]->extension_id; $this->app_name = $this->db->loadObjectList()[0]->extension_id; $this->app_info = json_decode($this->db->loadObjectList()[0]->manifest_cache); // Get our login information $config_query = "SELECT * FROM `#__mds_collivery_config` where id = 1;"; $this->db->setQuery($config_query); $this->db->query(); $this->password = $this->db->loadObjectList()[0]->password; $this->username = $this->db->loadObjectList()[0]->username; $this->risk_cover = $this->db->loadObjectList()[0]->risk_cover; $version = new JVersion(); require_once preg_replace('|com_installer|i', "", JPATH_COMPONENT_ADMINISTRATOR) . '/helpers/config.php'; $config = array('app_name' => $this->app_info->name, 'app_version' => $this->app_info->version, 'app_host' => "Joomla: " . $version->getShortVersion() . ' - Virtuemart: ' . VmConfig::getInstalledVersion(), 'app_url' => JURI::base(), 'user_email' => $this->username, 'user_password' => $this->password); // Use the MDS API Files require_once JPATH_PLUGINS . '/vmshipment/mds_shipping/Mds/Cache.php'; require_once JPATH_PLUGINS . '/vmshipment/mds_shipping/Mds/Collivery.php'; $this->collivery = new Mds\Collivery($config); // Get some information from the API $this->towns = $this->collivery->getTowns(); $this->services = $this->collivery->getServices(); $this->location_types = $this->collivery->getLocationTypes(); $this->suburbs = $this->collivery->getSuburbs(null); }
function preflight($type, $parent) { $jversion = new JVersion(); // Installing component manifest file version $this->release = $parent->get("manifest")->version; // If fresh install, lang file can't be loaded yet so use the tmp dir one. $lang = JFactory::getLanguage(); $lang->load('com_jckman', dirname(__FILE__)); $lang->load('com_jckman.sys', dirname(__FILE__)); // Manifest file minimum Joomla version $this->minimum_joomla_release = $parent->get("manifest")->attributes()->version; if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) { JError::raiseWarning(null, JText::sprintf('COM_JCKMAN_CUSTOM_INSTALL_NOT_JOOMLA_PRIOR', $this->minimum_joomla_release)); return false; } //Workaround I shouldn't have to do $app = JFactory::getApplication(); $db = JFactory::getDBO(); $sql = $db->getQuery(true); $sql->select('1')->from('#__extensions')->where('`name` = "com_jckman"'); if (!$db->setQuery($sql)->loadResult()) { $sql = $db->getQuery(true); $sql->delete('#__assets')->where('`title` like "%JCK%MAN%"'); $db->setQuery($sql)->query(); } }
function display($tpl = null) { if (JFactory::getUser()->get('guest')) { $msg = JText::_("ORDER_PLEASE_LOGIN_BEFORE"); $redirectUrl = base64_encode("index.php?option=com_enmasse&view=orderList"); $version = new JVersion(); $joomla = $version->getShortVersion(); if (substr($joomla, 0, 3) >= '1.6') { $link = JRoute::_("index.php?option=com_users&view=login&return=" . $redirectUrl, false); } else { $link = JRoute::_("index.php?option=com_user&view=login&return=" . $redirectUrl, false); } JFactory::getApplication()->redirect($link, $msg); } $orderList = JModel::getInstance('order', 'enmasseModel')->listForBuyer(JFactory::getUser()->id); for ($count = 0; $count < count($orderList); $count++) { $orderItemList = JModel::getInstance('orderItem', 'enmasseModel')->listByOrderId($orderList[$count]->id); $orderList[$count]->orderItem = $orderItemList[0]; $orderList[$count]->display_id = EnmasseHelper::displayOrderDisplayId($orderList[$count]->id); } $this->assignRef('orderList', $orderList); $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS); $this->_layout = "order_list"; parent::display($tpl); }
function getValidationPlugins() { jimport('joomla.version'); $db = JFactory::getDBO(); $version = new JVersion(); if (version_compare($version->getShortVersion(), '1.6', '>=')) { $db->setQuery("Select `element` From #__extensions Where `folder` = 'contentbuilder_validation' And `enabled` = 1"); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0', '>=')) { $res = $db->loadColumn(); } else { $res = $db->loadResultArray(); } return $res; } else { $db->setQuery("Select `element` From #__plugins Where `folder` = 'contentbuilder_validation' And `published` = 1"); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0', '>=')) { $res = $db->loadColumn(); } else { $res = $db->loadResultArray(); } return $res; } return array(); }
private function getJoomlaVersion() { $VERSION = new JVersion(); // Store in our object for switching configs $this->version = $VERSION->getShortVersion(); return $VERSION->getShortVersion(); }
public static function load() { if (self::$loaded) { return; } self::$loaded = true; include_once JPATH_ROOT . '/administrator/components/com_eventgallery/version.php'; $document = JFactory::getDocument(); //JHtml::_('behavior.framework', true); JHtml::_('behavior.formvalidation'); $params = JComponentHelper::getParams('com_eventgallery'); $doDebug = $params->get('debug', 0) == 1; $doManualDebug = JRequest::getString('debug', '') == 'true'; $CSSs = array(); $JSs = array(); if (version_compare(JVERSION, '3.0', 'gt')) { JHtml::_('jquery.framework'); } else { $JSs[] = 'common/js/jquery/jquery.min.js'; $JSs[] = 'common/js/jquery/jquery-migrate-1.2.1.min.js'; } $JSs[] = 'common/js/jquery/namespace.js'; // load script and styles in debug mode or compressed if ($doDebug || $doManualDebug) { $CSSs[] = 'frontend/css/eventgallery.css'; $CSSs[] = 'frontend/css/colorbox.css'; $joomlaVersion = new JVersion(); if (!$joomlaVersion->isCompatible('3.0')) { $CSSs[] = 'frontend/css/legacy.css'; } $JSs = array_merge($JSs, array('frontend/js/EventgalleryTools.js', 'frontend/js/EventgalleryTouch.js', 'frontend/js/jquery.colorbox.js', 'frontend/js/jquery.colorbox.init.js', 'frontend/js/EventgallerySizeCalculator.js', 'frontend/js/EventgalleryImage.js', 'frontend/js/EventgalleryRow.js', 'frontend/js/EventgalleryImageList.js', 'frontend/js/EventgalleryEventsList.js', 'frontend/js/EventgalleryEventsTiles.js', 'frontend/js/EventgalleryGridCollection.js', 'frontend/js/EventgalleryTilesCollection.js', 'frontend/js/EventgalleryCart.js', 'frontend/js/EventgallerySocialShareButton.js', 'frontend/js/EventgalleryJSGallery2.js', 'frontend/js/EventgalleryLazyload.js', 'frontend/js/EventgalleryBehavior.js')); } else { $joomlaVersion = new JVersion(); if (!$joomlaVersion->isCompatible('3.0')) { $CSSs[] = 'frontend/css/eg-l-compressed.css'; } else { $CSSs[] = 'frontend/css/eg-compressed.css'; } $JSs[] = 'frontend/js/eg-compressed.js'; } foreach ($CSSs as $css) { $script = JUri::root(true) . '/media/com_eventgallery/' . $css . '?v=' . EVENTGALLERY_VERSION; $document->addStyleSheet($script); } foreach ($JSs as $js) { $script = JUri::root(true) . '/media/com_eventgallery/' . $js . '?v=' . EVENTGALLERY_VERSION; $document->addScript($script); } /* * Let's add a global configuration object for the color box slideshow. */ $slideshowConfiguration = array(); $slideshowConfiguration['slideshow'] = $params->get('use_lightbox_slideshow', 0) == 1 ? true : false; $slideshowConfiguration['slideshowAuto'] = $params->get('use_lightbox_slideshow_autoplay', 0) == 1 ? true : false; $slideshowConfiguration['slideshowSpeed'] = $params->get('lightbox_slideshow_speed', 3000); $slideshowConfiguration['slideshowStart'] = JText::_('COM_EVENTGALLERY_LIGHTBOX_SLIDESHOW_START'); $slideshowConfiguration['slideshowStop'] = JText::_('COM_EVENTGALLERY_LIGHTBOX_SLIDESHOW_STOP'); $slideshowConfiguration['slideshowRightClickProtection'] = $params->get('lightbox_prevent_right_click', 0) == 1 ? true : false; $document->addScriptDeclaration("EventGallerySlideShowConfiguration=" . json_encode($slideshowConfiguration) . ";"); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $lang = JFactory::getLanguage(); $lang->load('lib_syw.sys', JPATH_SITE); $version = new JVersion(); $jversion = explode('.', $version->getShortVersion()); $extensions = get_loaded_extensions(); $html = ''; if (!in_array('intl', $extensions)) { if (intval($jversion[0]) > 2) { // Joomla! 3+ $html .= '<div class="alert alert-error">'; } else { $html .= '<div style="clear: both; margin: 5px 0; padding: 8px 35px 8px 14px; border-radius: 4px; border: 1px solid #EED3D7; background-color: #F2DEDE; color: #B94A48;">'; } $html .= '<span>'; $html .= JText::_('LIB_SYW_INTLTEST_NOTLOADED'); $html .= '</span>'; $html .= '</div>'; return $html; } else { if (intval($jversion[0]) > 2) { // Joomla! 3+ $html .= '<div class="alert alert-success">'; } else { $html .= '<div style="clear: both; margin: 5px 0; padding: 8px 35px 8px 14px; border-radius: 4px; border: 1px solid #D6E9C6; background-color: #DFF0D8; color: #468847;">'; } $html .= '<span>'; $html .= JText::_('LIB_SYW_INTLTEST_LOADED'); $html .= '</span>'; $html .= '</div>'; } return $html; }
public function onGetIcons($context) { @(include_once JPATH_ADMINISTRATOR . '/components/com_jce/models/model.php'); // check for class to prevent fatal errors if (!class_exists('WFModel')) { return; } if ($context != $this->params->get('context', 'mod_quickicon') || WFModel::authorize('browser') === false) { return; } $document = JFactory::getDocument(); $language = JFactory::getLanguage(); $language->load('com_jce', JPATH_ADMINISTRATOR); $width = $this->params->get('width', 800); $height = $this->params->get('height', 600); $filter = $this->params->get('filter', ''); JHtml::_('behavior.modal'); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tSqueezeBox.assign(\$\$('#plg_quickicon_jcefilebrowser a'), {\n\t\t\t\thandler: 'iframe', size: {x: " . $width . ", y: " . $height . "}\n\t\t\t});\n\t\t});"); require_once JPATH_ADMINISTRATOR . '/components/com_jce/helpers/browser.php'; $version = new JVersion(); $icon = $version->isCompatible('3.0') ? 'pictures' : 'header/icon-48-media.png'; $link = WFBrowserHelper::getBrowserLink('', $filter); if ($link) { return array(array('link' => $link, 'image' => $icon, 'icon' => 'pictures', 'access' => array('jce.browser', 'com_jce'), 'text' => JText::_('WF_QUICKICON_BROWSER'), 'id' => 'plg_quickicon_jcefilebrowser')); } return array(); }
public static function load() { if (self::$loaded) { return; } self::$loaded = true; include_once JPATH_ROOT . '/administrator/components/com_eventgallery/version.php'; $document = JFactory::getDocument(); JHtml::_('behavior.formvalidation'); $CSSs = array(); $JSs = array(); if (version_compare(JVERSION, '3.0', 'gt')) { JHtml::_('jquery.framework'); } else { $JSs[] = 'common/js/jquery/jquery.min.js'; $JSs[] = 'common/js/jquery/jquery-migrate-1.2.1.min.js'; } $JSs[] = 'common/js/jquery/namespace.js'; $CSSs[] = 'backend/css/eventgallery.css'; $joomlaVersion = new JVersion(); if (!$joomlaVersion->isCompatible('3.0')) { $CSSs[] = 'backend/css/legacy.css'; } $JSs = array_merge($JSs, array()); foreach ($CSSs as $css) { $script = JURI::root() . 'media/com_eventgallery/' . $css . '?v=' . EVENTGALLERY_VERSION; $document->addStyleSheet($script); } foreach ($JSs as $js) { $script = JURI::root() . 'media/com_eventgallery/' . $js . '?v=' . EVENTGALLERY_VERSION; $document->addScript($script); } }
function display($tpl = null) { $this->days = $this->get('Days'); $this->countDays = $this->get('CountDays'); $this->state = $this->get('State'); jimport('joomla.html.pagination'); $limit = JRequest::getVar('limit', '25', '', 'int'); $limitstart = JRequest::getVar('limitstart', '0', '', 'int'); $pagination = new JPagination($this->countDays, $limitstart, $limit); $this->pagination = $pagination; // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); if (class_exists('JHtmlSidebar')) { $this->sidebar = JHtmlSidebar::render(); } $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0.0', '<')) { $tpl = 'legacy'; } parent::display($tpl); }
protected function getInput() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('TIME_TO_SEC(TIMEDIFF(ADDDATE(`lastattempt`,INTERVAL `penalty` MINUTE),NOW())) AS timeleft,ip,firstattempt,lastattempt,attempts,penalty')->from('#__plg_system_adminexile')->where('penalty > 0')->order('lastattempt DESC'); $db->setQuery($query); $blocked = $db->loadObjectList(); if(!count($blocked)) return ''; $version = new JVersion; $shortversion = explode('.',$version->getShortVersion()); $return=array(); $deletetext = ''; if($shortversion[0] == 2) { $deletetext = JText::_('JACTION_DELETE'); } $return[]='<table class="table table-condensed table-striped bruteforce"><tr><th>IP</th><th>'.JText::_('PLG_SYS_ADMINEXILE_FIRST_ATTEMPT').'</th><th>'.JText::_('PLG_SYS_ADMINEXILE_LAST_ATTEMPT').'</th><th>'.JText::_('PLG_SYS_ADMINEXILE_ATTEMPTS').'</th><th>'.JText::_('PLG_SYS_ADMINEXILE_PENALTY').'</th><td></td></tr>'; foreach($blocked as $match) { if($match->timeleft <= 0) { $query = $db->getQuery(true); $query->delete('#__plg_system_adminexile')->where('ip = '.$db->quote($match->ip)); $db->setQuery($query); $db->query(); } else { $buttons = '<button class="btn btn-mini removeblock hasTip" data-block="'.htmlentities(json_encode(array('ip'=>$match->ip,'firstattempt'=>$match->firstattempt))).'" data-toggle="tooltip" title="'.JText::_('JACTION_DELETE').'"><i class="icon-trash"></i>'.$deletetext.'</button>'; $return[]='<td>'.$match->ip.'</td><td>'.$match->firstattempt.'</td><td>'.$match->lastattempt.'</td><td>'.$match->attempts.'</td><td>'.$match->penalty.'</td><td>'.$buttons.'</td></tr>'; } } $return[]='</table>'; return implode("\n",$return); }
function onDisplay($name, $asset, $author) { global $app; JHtml::_('behavior.modal'); $doc = JFactory::getDocument(); $link = $app->isAdmin() ? '..' : ''; $link .= '/plugins/editors-xtd/rokbox/views/rokbox-picker.php?'; $link .= 'textarea=' . $name; $link .= '&asset=' . $asset; $link .= '&author=' . $author; $link .= '&bp=' . urlencode(JURI::root()); $version = new JVersion(); $image_path = JURI::root(true) . '/plugins/editors-xtd/rokbox/assets/images/'; if (version_compare($version->getShortVersion(), '3.0', '>=')) { $style = ".btn .icon-linkrokbox {background: url(" . $image_path . "rokbox_14x14.png) 100% 0 no-repeat;}"; } else { $style = ".button2-left .linkrokbox {background: url(" . $image_path . "rokbox-button.png) 100% 0 no-repeat;}"; } $doc->addStyleDeclaration($style); $button = new JObject(); $button->set('modal', true); $button->set('class', 'btn'); $button->set('link', $link); $button->set('text', JText::_('RokBox')); $button->set('name', 'linkrokbox'); $button->set('options', "{handler: 'iframe', size: {x: 520, y: 430}}"); return $button; }
/** * Display the toolbar * * @access private */ protected function addToolbar() { $state = $this->get('State'); $doc = JFactory::getDocument(); $version = new JVersion(); JToolBarHelper::addNew('sitemap.add'); JToolBarHelper::custom('sitemap.edit', 'edit.png', 'edit_f2.png', 'JTOOLBAR_EDIT', true); $doc->addStyleDeclaration('.icon-48-sitemap {background-image: url(components/com_xmap/images/sitemap-icon.png);}'); JToolBarHelper::title(JText::_('XMAP_SITEMAPS_TITLE'), 'sitemap.png'); JToolBarHelper::custom('sitemaps.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_Publish', true); JToolBarHelper::custom('sitemaps.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); if (version_compare($version->getShortVersion(), '3.0.0', '>=')) { JToolBarHelper::custom('sitemaps.setdefault', 'featured.png', 'featured_f2.png', 'XMAP_TOOLBAR_SET_DEFAULT', true); } else { JToolBarHelper::custom('sitemaps.setdefault', 'default.png', 'default_f2.png', 'XMAP_TOOLBAR_SET_DEFAULT', true); } if ($state->get('filter.published') == -2) { JToolBarHelper::deleteList('', 'sitemaps.delete', 'JTOOLBAR_DELETE'); } else { JToolBarHelper::trash('sitemaps.trash', 'JTOOLBAR_TRASH'); } JToolBarHelper::divider(); if (class_exists('JHtmlSidebar')) { JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); $this->sidebar = JHtmlSidebar::render(); } }
public function install($adapter) { $version = new JVersion(); $db = JFactory::getDbo(); $module = JTable::getInstance('module'); if ($module->load(array('module' => 'mod_comprofileronline', 'position' => '')) || !$module->load(array('module' => 'mod_comprofileronline'))) { $module->set('title', 'CB Online'); $module->set('ordering', '3'); $module->set('position', 'position-7'); $module->set('published', '1'); $module->set('module', 'mod_comprofileronline'); $module->set('access', '1'); $module->set('showtitle', '1'); if ($version->isCompatible('3.0')) { $module->set('params', '{"pretext":"","posttext":"","cb_plugins":"0","layout":"_:default","moduleclass_sfx":"","cache":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}'); } else { $module->set('params', '{"pretext":"","posttext":"","cb_plugins":"0","layout":"_:default","moduleclass_sfx":"","cache":"0"}'); } $module->set('client_id', '0'); $module->set('language', '*'); if ($module->store()) { $moduleId = $module->get('id'); if ($moduleId) { $db->setQuery('INSERT IGNORE INTO `#__modules_menu` ( `moduleid`, `menuid` ) VALUES ( ' . (int) $moduleId . ', 0 )'); try { $db->execute(); } catch (RuntimeException $e) { } } } } }
public static function helpsite($value) { if (empty($value)) { return self::value($value); } else { $version = new JVersion(); $jver = explode('.', $version->getShortVersion()); $pathToXml = JPATH_ADMINISTRATOR . '/help/helpsites.xml'; $text = $value; if (!empty($pathToXml) && ($xml = JFactory::getXML($pathToXml))) { foreach ($xml->sites->site as $site) { if ((string) $site->attributes()->url == $value) { $text = (string) $site; break; } } } $value = htmlspecialchars($value); if (substr($value, 0, 4) == "http") { return '<a href="' . $value . '">' . $text . '</a>'; } else { return '<a href="http://' . $value . '">' . $text . '</a>'; } } }
function display($tpl = null) { $this->categories = $this->get('Categories'); $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->countItems = $this->get('CountItems'); $this->pagination = $this->get('Pagination'); /* jimport('joomla.html.pagination'); $limit = JRequest::getVar('limit', '25', '', 'int'); $limitstart = JRequest::getVar('limitstart', '0', '', 'int'); $pagination = new JPagination($this->countItems, $limitstart, $limit); $this->pagination = $pagination;*/ // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0.0', '<')) { $tpl = 'legacy'; } else { /*JHtmlSidebar::addFilter( JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category', JHtml::_('select.options', DJClassifiedsCategory::getCatSelect(), 'value', 'text', $this->state->get('filter.category'), true) );*/ JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', array(JHtml::_('select.option', '1', 'JPUBLISHED'), JHtml::_('select.option', '0', 'JUNPUBLISHED')), 'value', 'text', $this->state->get('filter.published'), true)); JHtmlSidebar::addFilter(JText::_('COM_DJCLASSIFIEDS_SELECT_ACTIVE'), 'filter_active', JHtml::_('select.options', array(JHtml::_('select.option', '1', 'COM_DJCLASSIFIEDS_ACTIVE'), JHtml::_('select.option', '0', 'COM_DJCLASSIFIEDS_HIDE')), 'value', 'text', $this->state->get('filter.active'), true)); $this->sidebar = JHtmlSidebar::render(); } parent::display($tpl); }
/** * Method to run before an install/update/uninstall method * * @param string $type is the type of change (install, update or discover_install) * @param object $parent is the class calling this method * * @return boolean false if error occurs */ function preflight($type, $parent) { $app = JFactory::getApplication(); $jversion = new JVersion(); $jInstall = new JInstaller('mod_bwpostman_overview'); // Get component manifest file version $this->release = $parent->get("manifest")->version; // Manifest file minimum Joomla version $this->minimum_joomla_release = $parent->get("manifest")->attributes()->version; // abort if the current Joomla release is older if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) { $app->enqueueMessage(JText::sprintf('MOD_BWPOSTMAN_OVERVIEW_INSTALL_ERROR_JVERSION', $this->minimum_joomla_release), 'error'); return false; } if (floatval(phpversion()) < 5) { $app->enqueueMessage(JText::_('MOD_BWPOSTMAN_OVERVIEW_USES_PHP5'), 'error'); return false; } // abort if the component being installed is not newer than the currently installed version if ($type == 'update') { $oldRelease = $this->getManifestVar('version'); $app->setUserState('mod_bwpostman_overview.update.oldRelease', $oldRelease); if (version_compare($this->release, $oldRelease, 'lt')) { $app->enqueueMessage(JText::sprintf('MOD_BWPOSTMAN_OVERVIEW_INSTALL_ERROR_INCORRECT_VERSION_SEQUENCE', $oldRelease, $this->release), 'error'); return false; } } return true; }
/** * Method to get the field input markup for a generic list. * Use the multiple attribute to enable multiselect. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $document = JFactory::getDocument(); $jsPath = JURI::root(true) . '/modules/mod_currentdatetime/js'; $joomlaVersion = new JVersion(); if ($joomlaVersion->isCompatible('3')) { JHtml::_('jquery.ui', array('core', 'sortable')); } else { $document->addStyleSheet($jsPath . '/25/css/chosen.min.css'); $document->addScript($jsPath . '/25/jquery.min.js'); $document->addScript($jsPath . '/25/jquery-noconflict.js'); $document->addScript($jsPath . '/25/chosen.jquery.min.js'); $document->addScript($jsPath . '/25/jquery.ui.core.min.js'); $document->addScript($jsPath . '/25/jquery.ui.widget.min.js'); $document->addScript($jsPath . '/25/jquery.ui.mouse.min.js'); $document->addScript($jsPath . '/25/jquery.ui.sortable.min.js'); } $document->addScript($jsPath . '/jquery-chosen-sortable.min.js'); $script = 'jQuery(function(){jQuery(".chzn-sortable").chosen().chosenSortable();});'; $document->addScriptDeclaration($script); if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $html = parent::getInput(); return $html; }
/** * Method to get the field input markup. */ protected function getInput() { $version = new JVersion(); $jversion = explode('.', $version->getShortVersion()); $title = trim($this->element['title']); $image_src = $this->element['imagesrc']; $text = trim($this->element['text']); $link = $this->element['link']; $titleintext = false; if ($this->element['titleintext']) { $titleintext = $this->element['titleintext'] === 'true'; } if (intval($jversion[0]) > 2 || $image_src && intval($jversion[0]) < 3) { $html = '<div style="padding-top: 5px; overflow: inherit">'; } else { $html = '<div>'; } if ($titleintext) { $html .= '<strong>' . JText::_($title) . '</strong>: '; } if ($text) { $html .= JText::sprintf($text, $link); } if (intval($jversion[0]) > 2) { // J3+ } else { $html .= '</div>'; } $html .= '</div>'; return $html; }
public function preflight($type, $parent) { $jversion = new JVersion(); // INSTALLING COMPONENT MANIFEST FILE VERSION $this->release = $parent->get("manifest")->version; // MANIFEST FILE MINIMUM JOOMLA VERSION $this->minimum_joomla_release = $parent->get("manifest")->attributes()->version; // ABORT IF THE CURRENT JOOMLA RELEASE IS OLDER if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_MAPBOX_MSG_ERROR_JVERSION', $this->minimum_joomla_release), 'error'); return false; } // ABORT IF THE COMPONENT BEING INSTALLED IS NOT NEWER THAN THE CURRENTLY INSTALLED VERSION if ($type == 'update') { $oldRelease = $this->getParam('version'); $rel = $oldRelease . ' to ' . $this->release; if (version_compare($this->release, $oldRelease, 'le')) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_MAPBOX_MSG_ERROR_SCHEMA', $this->release), 'error'); return false; } } else { $rel = $this->release; } // ABORT IF THE SERVER ENVIRONMENT DOES NOT INCLUDE THE GD LIBRARIES if (!extension_loaded('gd')) { JFactory::getApplication()->enqueueMessage(JText::_('COM_MAPBOX_MSG_ERROR_GD_MISSING'), 'error'); return false; } // ABORT IF THE IMAGES DIRECTORY IS NOT WRITEABLE if (!is_writeable(JPATH_ROOT . "/images")) { JFactory::getApplication()->enqueueMessage(JText::_('COM_MAPBOX_INSTALL_ERROR_PERMISSIONS'), 'error'); return false; } echo '<p>' . JText::_('COM_MAPBOX_MSG_SUCCESS_PREFLIGHT') . '</p>'; }
/** * Method to get the field label markup for a spacer. * Use the label text or name from the XML element as the spacer or * Use a hr="true" to automatically generate plain hr markup * * @return string The field label markup. * * @since 11.1 */ protected function getLabel() { $document = JFactory::getDocument(); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0.0', '<')) { $document->addStylesheet(JURI::base(true) . '/components/com_djclassifieds/assets/style.css'); } else { $document->addStylesheet(JURI::base(true) . '/components/com_djclassifieds/assets/style.css'); } $html = array(); $class = $this->element['class'] ? (string) $this->element['class'] : ''; $class .= ' djspacer'; $html[] = '<span class="spacer">'; $html[] = '<span class="before"></span>'; $html[] = '<span class="' . $class . '">'; $label = ''; // Get the label text from the XML element, defaulting to the element name. $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; $text = $this->translateLabel ? JText::_($text) : $text; // Build the class for the label. //$class = !empty($this->description) ? 'hasTip' : ''; // Add the opening label tag and main attributes attributes. $label .= '<label id="' . $this->id . '-lbl">' . $text; // If a description is specified, use it to build a tooltip. if (!empty($this->description)) { $label .= ' <div class="small">' . ($this->translateDescription ? JText::_($this->description) : $this->description) . '</div> '; } // Add the label text and closing tag. $label .= '</label>'; $html[] = $label; $html[] = '</span>'; $html[] = '<span class="after"></span>'; $html[] = '</span>'; return implode('', $html); }