private function getJoomlaVersion() { $VERSION = new JVersion(); // Store in our object for switching configs $this->version = $VERSION->getShortVersion(); return $VERSION->getShortVersion(); }
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 display($tpl = null) { echo ' <style type="text/css"> .icon-48-logo_left { background-image: url(../administrator/components/com_contentbuilder/views/logo_left.png); } </style> '; jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '1.6', '>=')) { echo '<link rel="stylesheet" href="' . JURI::root(true) . '/administrator/components/com_contentbuilder/views/bluestork.fix.css" type="text/css" />'; } if (version_compare(CBJOOMLAVERSION, '3.0', '<')) { JToolBarHelper::title('<img src="components/com_contentbuilder/views/logo_right.png" alt="" align="top" /> <span style="display:inline-block; vertical-align:middle"> :: ' . JText::_('COM_CONTENTBUILDER_FORMS') . '</span>', 'logo_left.png'); } else { JToolBarHelper::title('ContentBuilder :: ' . JText::_('COM_CONTENTBUILDER_FORMS') . '</span>', 'logo_left.png'); } if (version_compare($version->getShortVersion(), '3.0', '<')) { JToolBarHelper::editListX(); JToolBarHelper::addNewX(); JToolBarHelper::customX('copy', 'copy', '', JText::_('COM_CONTENTBUILDER_COPY')); } else { JToolBarHelper::addNew(); JToolBarHelper::custom('copy', 'copy', '', JText::_('COM_CONTENTBUILDER_COPY')); JToolBarHelper::editList(); } JToolBarHelper::deleteList(); if (version_compare($version->getShortVersion(), '1.6', '>=')) { JToolBarHelper::preferences('com_contentbuilder'); } // Get data from the model $items = $this->get('Data'); $pagination = $this->get('Pagination'); $tags = $this->get('Tags'); $state = $this->get('state'); $lists['order_Dir'] = $state->get('forms_filter_order_Dir'); $lists['order'] = $state->get('forms_filter_order'); $lists['state'] = JHTML::_('grid.state', $state->get('forms_filter_state')); $lists['limitstart'] = $state->get('limitstart'); $lists['filter_tag'] = $state->get('forms_filter_tag'); $ordering = $lists['order'] == 'ordering'; $this->assignRef('ordering', $ordering); $this->assignRef('tags', $tags); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); parent::display($tpl); }
/** * 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(); } }
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); }
static function save($option, $pkg) { $database = JFactory::getDBO(); $row = new facileFormsMenus($database); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0', '>=')) { unset($_POST['ordering']); unset($row->ordering); } // bind it to the table if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // if // store it in the db if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // if $row->reorder('parent=' . $row->parent); $result = updateComponentMenus(); $type = 'message'; $msg = BFText::_('COM_BREEZINGFORMS_MENUS_SAVED'); if ($result != '') { $msg = $result; $type = 'error'; } JFactory::getApplication()->redirect("index.php?option={$option}&act=managemenus&pkg={$pkg}", $msg, $type); }
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 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; }
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); }
function com_install() { // Initialize system variables $db = JFactory::getDBO(); $application = JFactory::getApplication(); // Do a simple PHP-check if (version_compare(phpversion(), '5.2.0', '>=') == false) { $application->enqueueMessage(JText::_('PHP 5.2.0 or higher is required.'), 'error'); return false; } // Do a simple Joomla! version-check $jversion = new JVersion(); if (version_compare($jversion->getShortVersion(), '1.5.9', '>=') == false) { $application->enqueueMessage(JText::_('Joomla! 1.5.9 or higher is required.'), 'error'); return false; } // Collection of queries were going to try $update_queries = array('INSERT INTO `#__simplelists_categories` (`id`, `category_id` ) SELECT `id`,`catid` FROM `#__simplelists`', 'ALTER TABLE `#__simplelists` DROP COLUMN `catid`', 'ALTER TABLE `#__simplelists` ADD COLUMN `link_type` INT(11) NOT NULL DEFAULT 0 AFTER `title`', 'ALTER TABLE `#__simplelists` ADD COLUMN `hits` INT(11) NOT NULL DEFAULT 0 AFTER `ordering`', 'ALTER TABLE `#__simplelists` CHANGE `url` `link` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL', 'ALTER TABLE `#__simplelists` ADD COLUMN `created` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00" AFTER `published`', 'ALTER TABLE `#__simplelists` ADD COLUMN `created_by` INT(11) NOT NULL DEFAULT 0 AFTER `created`', 'ALTER TABLE `#__simplelists` ADD COLUMN `created_by_alias` TEXT AFTER `created_by`', 'ALTER TABLE `#__simplelists` ADD COLUMN `modified` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00" AFTER `created_by_alias`', 'ALTER TABLE `#__simplelists` ADD COLUMN `modified_by` INT(11) NOT NULL DEFAULT 0 AFTER `modified`', 'ALTER TABLE `#__simplelists` ADD COLUMN `modified_by_alias` TEXT AFTER `modified_by`', 'UPDATE `#__components` SET `link`="option=com_simplelists", `admin_menu_link`="option=com_simplelists&view=categories" WHERE `admin_menu_link`="option=com_categories§ion=com_simplelists"', 'UPDATE `#__components` SET `link`="option=com_simplelists", `admin_menu_link`="option=com_simplelists&view=items" WHERE `admin_menu_link`="option=com_simplelists"', 'UPDATE `#__simplelists` SET `picture`=CONCAT("images/simplelists/", picture) WHERE `picture` != "" AND `picture` NOT LIKE "%images/simplelists%"', 'DELETE FROM #__simplelists_categories WHERE id NOT IN ( SELECT id FROM #__simplelists )', 'ALTER TABLE `#__simplelists` CHANGE `link_type` `link_type` VARCHAR( 20 ) NOT NULL', 'UPDATE `#__simplelists` SET `link_type`="" WHERE `link_type`="0"', 'UPDATE `#__simplelists` SET `link_type`="custom" WHERE `link_type`="1"', 'UPDATE `#__simplelists` SET `link_type`="menuitem" WHERE `link_type`="2"', 'UPDATE `#__simplelists` SET `link_type`="article" WHERE `link_type`="3"', 'UPDATE `#__simplelists` SET `link_type`="image" WHERE `link_type`="4"', 'UPDATE `#__simplelists` SET `link_type`="file" WHERE `link_type`="5"', 'UPDATE `#__categories` SET `image`=CONCAT("images/simplelists/", image) WHERE `image` != "" AND `image` NOT LIKE "%images/simplelists%" AND `section`="com_simplelists"', 'ALTER TABLE `#__simplelists` ADD `alias` VARCHAR(255) NOT NULL AFTER `title`', 'ALTER TABLE `#__simplelists` ADD `access` INT( 11 ) NOT NULL AFTER `published`', 'RENAME TABLE `#__simplelists` TO `#__simplelists_items`', 'UPDATE #__menu SET link = REPLACE(link,"option=com_simplelists&view=simplelist","option=com_simplelists&view=items")', 'ALTER TABLE `#__simplelists_items` ADD `asset_id` INT( 11 ) NOT NULL AFTER `id`', 'ALTER TABLE `#__simplelists_items` ADD `article_id` INT( 11 ) NOT NULL AFTER `asset_id`', 'ALTER TABLE `#__simplelists_items` CHANGE `link_type` `link_type` VARCHAR(255) NOT NULL DEFAULT "0"', 'ALTER TABLE `#__simplelists_items` ADD `flags` VARCHAR(10) NOT NULL AFTER `picture`', 'DROP TABLE `#__simplelists_plugins`'); // Perform all queries - we don't care if it fails foreach ($update_queries as $query) { $db->debug(0); $db->setQuery($query); $db->query(); } }
/** * 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; }
/** * 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; }
/** * 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); }
private function checkAccess() { if (JFactory::getUser()->get('guest')) { $msg = JText::_("SALE_PLEASE_LOGIN_BEFORE"); $redirectUrl = base64_encode("index.php?option=com_enmasse&controller=saleReports&task=dealReport"); $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); } $salesPersonId = JFactory::getSession()->get('salesPersonId'); if ($salesPersonId == null) { $salesPerson = JModel::getInstance('salesPerson', 'enmasseModel')->getByUserName(JFactory::getUser()->get('username')); if ($salesPerson != null) { JFactory::getSession()->set('salesPersonId', $salesPerson->id); } else { $msg = JText::_('SALE_NO_ACCESS'); $link = JRoute::_("index.php?option=com_enmasse&controller=deal&task=listing", false); JFactory::getApplication()->redirect($link, $msg); } } return $salesPersonId; }
/** * Method to get the field input markup */ protected function getInput() { $lang = JFactory::getLanguage(); $lang->load('lib_syw.sys', JPATH_SITE); $setting_to_test = trim($this->element['setting']); $version = new JVersion(); $jversion = explode('.', $version->getShortVersion()); $html = ''; if (!ini_get($setting_to_test)) { 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::sprintf('LIB_SYW_PHPSETTING_DISABLED', $setting_to_test); $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::sprintf('LIB_SYW_PHPSETTING_ENABLED', $setting_to_test); $html .= '</span>'; $html .= '</div>'; } return $html; }
/** * 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); $alertmessage = trim($this->element['alertmessage']) === "false" ? FALSE : TRUE; $html = ''; $version = new JVersion(); $jversion = explode('.', $version->getShortVersion()); $folder = JPATH_ROOT . '/components/com_k2'; if (!JFolder::exists($folder)) { /*if (intval($jversion[0]) > 2) { $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_K2TEST_MISSING'); $html .= '</span>'; $html .= '</div>';*/ } else { if ($alertmessage) { if (intval($jversion[0]) > 2) { $html .= '<div class="alert alert-message">'; } 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_K2TEST_SELECTLAYOUT'); $html .= '</span>'; $html .= '</div>'; } } return $html; }
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>'; } } }
/** * 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; }
/** * 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; }
function save() { $data = JRequest::get('post'); $version = new JVersion(); $joomla = $version->getShortVersion(); $err = $this->validateSetting($data); if (substr($joomla, 0, 3) >= '1.6') { $data['article_id'] = JRequest::getVar('_id'); } else { $control_name = JRequest::getVar('control_name'); $data['article_id'] = $control_name['name']; } $model = JModel::getInstance('setting', 'enmasseModel'); if (!empty($err)) { $msg = JText::_('SAVE_ERROR_MSG') . ": " . $err['msg']; if ($data['id'] == null) { $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=add', $msg, 'error'); } else { $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=edit&cid[0]=' . $data['id'], $msg, 'error'); } } else { if ($model->store($data)) { $msg = JText::_('SAVE_SUCCESS_MSG'); $this->setRedirect('index.php?option=com_enmasse', $msg); } else { $msg = JText::_('SAVE_ERROR_MSG') . ": " . $model->getError(); if ($data['id'] == null) { $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=add', $msg, 'error'); } else { $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=edit&cid[0]=' . $data['id'], $msg, 'error'); } } } }
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>'; }
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(); }
/** * 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 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 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); } }
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 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 __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 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); }
public function onUserAfterSave($user, $isnew, $success, $msg) { if ($isnew) { $db = JFactory::getDbo(); $date = JFactory::getDate(); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0') >= 0) { $created = $date->toSQL(); } else { $created = $date->toMySQL(); } $query = 'INSERT INTO ' . $db->quoteName('#__authorlist') . ' (' . $db->quoteName('userid') . ', ' . $db->quoteName('alias') . ', ' . $db->quoteName('state') . ', ' . $db->quoteName('access') . ', ' . $db->quoteName('created') . ', ' . $db->quoteName('created_by') . ' ) VALUES ( ' . (int) $user['id'] . ', "' . $user['username'] . '", 1 , ' . $this->params->get("access") . ' , "' . $created . '", ' . (int) $user['id'] . ' )'; $db->setQuery($query); $db->Query(); } return true; }