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)); }
public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config); $jversion = new JVersion(); if ($jversion->isCompatible('2.5') && !$jversion->isCompatible('3.0')) { $this->loadLanguage(); } }
public function install($adapter) { $version = new JVersion(); $db = JFactory::getDbo(); $module = JTable::getInstance('module'); if ($module->load(array('module' => 'mod_cblogin', 'position' => '')) || !$module->load(array('module' => 'mod_cblogin'))) { $module->set('title', 'CB Login'); $module->set('ordering', '1'); $module->set('position', 'position-7'); $module->set('published', '1'); $module->set('module', 'mod_cblogin'); $module->set('access', '1'); $module->set('showtitle', '1'); if ($version->isCompatible('3.0')) { $module->set('params', '{"show_buttons_icons":"0","https_post":"0","cb_plugins":"1","pretext":"","posttext":"","login":"","name_label":"5","name_length":"14","pass_label":"5","pass_length":"14","key_label":"5","key_length":"14","remember_enabled":"1","show_lostpass":"******","show_newaccount":"1","login_message":"0","logoutpretext":"","logoutposttext":"","logout":"index.php","greeting":"1","show_avatar":"1","text_show_profile":"","icon_show_profile":"0","text_edit_profile":"","icon_edit_profile":"0","show_pms":"0","show_pms_icon":"0","show_connection_notifications":"0","show_connection_notifications_icon":"0","logout_message":"0","layout":"_:bootstrap","moduleclass_sfx":"","cache":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}'); } else { $module->set('params', '{"show_buttons_icons":"0","https_post":"0","cb_plugins":"1","pretext":"","posttext":"","login":"","name_label":"1","name_length":"14","pass_label":"1","pass_length":"14","key_label":"1","key_length":"14","remember_enabled":"1","show_lostpass":"******","show_newaccount":"1","login_message":"0","logoutpretext":"","logoutposttext":"","logout":"index.php","greeting":"1","show_avatar":"1","text_show_profile":"","icon_show_profile":"0","text_edit_profile":"","icon_edit_profile":"0","show_pms":"0","show_pms_icon":"0","show_connection_notifications":"0","show_connection_notifications_icon":"0","logout_message":"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 function preflight($type, $parent) { if ($type != 'uninstall') { $app = JFactory::getApplication(); if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/rsform.php')) { $app->enqueueMessage('Please install the RSForm! Pro component before continuing.', 'error'); return false; } if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/version.php')) { $app->enqueueMessage('Please upgrade RSForm! Pro to at least R45 before continuing!', 'error'); return false; } $jversion = new JVersion(); if (!$jversion->isCompatible('2.5.5')) { $app->enqueueMessage('Please upgrade to at least Joomla! 2.5.5 before continuing!', 'error'); return false; } if (file_exists(JPATH_SITE . '/plugins/system/rsfppaypal/rsfppaypal.xml')) { $xml = file_get_contents(JPATH_SITE . '/plugins/system/rsfppaypal/rsfppaypal.xml'); if (strpos($xml, '<extension') === false) { $this->migrate = true; } } } return true; }
/** * Display the view */ public function display($tpl = null) { require_once JPATH_SITE . '/administrator/components/com_einsatzkomponente/helpers/einsatzkomponente.php'; // Helper-class laden $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); $this->gmap_config = EinsatzkomponenteHelper::load_gmap_config(); // GMap-Config aus helper laden $document = JFactory::getDocument(); // Import Jquery $version = new JVersion(); if ($version->isCompatible('3.0')) { } else { $document->addScript('../components/com_einsatzkomponente/assets/jquery/jquery1.9.1.js'); } // prüfen ob jquery geladen wurde echo "<script type=\"text/javascript\">\n\t\tif(typeof jQuery == \"function\")\n\t\telse\n\t\t alert(\"jQuery nicht geladen\");\n\t\t</script>"; // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } // Load JQuery Framework //JHtml::_('jquery.framework'); // added_130207 $this->addToolbar(); parent::display($tpl); }
/** * get all events_categories to use category color * @return object */ function getCategoryData() { static $cats; if (!isset($cats)) { $db =& JFactory::getDBO(); if (JVersion::isCompatible("1.6.0")) { $sql = "SELECT c.* FROM #__categories as c WHERE extension='" . JEV_COM_COMPONENT . "' order by c.lft asc"; $db->setQuery($sql); $cats = $db->loadObjectList('id'); foreach ($cats as &$cat) { $cat->name = $cat->title; $params = new JParameter($cat->params); $cat->color = $params->get("catcolour", ""); $cat->overlaps = $params->get("overlaps", 0); } unset($cat); } else { $sql = "SELECT c.*, e.color FROM #__jevents_categories AS e LEFT JOIN #__categories as c ON c.id=e.id"; $db->setQuery($sql); $cats = $db->loadObjectList('id'); } $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onGetCategoryData', array(&$cats)); } $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onGetAccessibleCategories', array(&$cats)); return $cats; }
function fetchElement($name, $value, &$node, $control_name) { // Must load admin language files $lang =& JFactory::getLanguage(); $lang->load("com_jevents", JPATH_ADMINISTRATOR); // TODO 1.6 ACL VERSION OF THIS if (JVersion::isCompatible("1.6.0")) { return ""; } $acl =& JFactory::getACL(); $gtree = $acl->get_group_children_tree(null, 'USERS', false); foreach ($gtree as &$item) { if ($item->value > 25) { $item->disable = true; } } unset($item); $ctrl = $control_name . '[' . $name . ']'; $attribs = ' '; if ($v = $node->attributes('size')) { $attribs .= 'size="' . $v . '"'; } if ($v = $node->attributes('class')) { $attribs .= 'class="' . $v . '"'; } else { $attribs .= 'class="inputbox"'; } if ($m = $node->attributes('multiple')) { $attribs .= 'multiple="multiple"'; $ctrl .= '[]'; //$value = implode( '|', ) } //array_unshift( $editors, JHTML::_('select.option', '', '- '. JText::_( 'SELECT_EDITOR' ) .' -' ) ); return JHTML::_('select.genericlist', $gtree, $ctrl, $attribs, 'value', 'text', $value, $control_name . $name); }
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) . ";"); }
/** * Function called before module installation/update/removal procedure commences * * @param string $type The type of change (install, update or discover_install * , not uninstall) * @param JInstallerAdapterModule $parent The class calling this method * * @return void * * @since 1.3.3 */ public function preflight($type, $parent) { $version = new JVersion(); if (!$version->isCompatible('3.2.0')) { JFactory::getApplication()->enqueueMessage(JText::_('JJ_SOCIAL_SLIDER_JOOMLA_VERSION_OUTDATED')); return false; } // Module manifest file version $this->release = $parent->get("manifest")->version; // Abort if the module being installed is not newer than the currently installed version if ($type == 'Update') { $manifest = $this->getItemArray('manifest_cache', '#__extensions', 'element', JFactory::getDbo()->quote($this->extension)); $oldRelease = $manifest['version']; if (version_compare($oldRelease, $this->release, '<')) { // Update to reflect colour form field change in 1.3.2 if (version_compare($oldRelease, '1.3.2', '<=')) { $this->update132(); } // Update to reflect move from assets subfolder to media folder if (version_compare($oldRelease, '1.4.0', '<=')) { $this->update140(); } } } }
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 DefaultViewHelperFooter($view) { if (JVersion::isCompatible("1.6.0")) { return $view->_footer16(); } if (JRequest::getInt('pop', 0)) { ?> <div class="ev_noprint"><p align="center"> <a href="#close" onclick="if (window.parent==window){self.close();} else try {window.parent.SqueezeBox.close(); return false;} catch(e) {self.close();return false;}" title="<?php echo JText::_('JEV_CLOSE'); ?> "><?php echo JText::_('JEV_CLOSE'); ?> </a> </p></div> <?php } $view->loadHelper("JevViewCopyright"); JevViewCopyright(); ?> </td> </tr> </table> <?php $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onJEventsFooter'); $task = JRequest::getString("jevtask"); $view->loadModules("jevpostjevents"); $view->loadModules("jevpostjevents_" . $task); }
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 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 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(); }
/** * 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 called to prepare content before html output * * @param string $context The context of the content being passed to the plugin. * @param object &$item The content object. Note $item->text is also available * @param object &$params The content params. * @param integer $page The 'page' number. * * @return mixed Returns void on success or false otherwise * * @since 2.5 */ public function onContentPrepare($context, &$row, &$params, $page = 0) { require_once dirname(__FILE__) . '/helper.php'; // Simple performance check to determine whether bot should process further. if (JString::strpos($row->text, '{gallery}') === false) { return; } $regex = "/{gallery}(.+?){\\/gallery}/is"; preg_match_all($regex, $row->text, $matches); if (!count($matches)) { return; } // Get the path for the layout file $version = new JVersion(); if ($version->isCompatible(3.0)) { $path = JPluginHelper::getLayoutPath('content', 'gallery'); } else { $path = GalleryHelper::getLayoutPath('content', 'gallery'); } foreach ($matches[1] as $source) { $row->gallery = GalleryHelper::getGallery($source, '200x160', true, 90, 86400, $row->id); ob_start(); include $path; $html = ob_get_contents(); ob_end_clean(); $regex = '/{gallery}' . str_replace('.', '\\.', str_replace('/', '\\/', $source)) . '{\\/gallery}/is'; $row->text = preg_replace($regex, $html, $row->text); } return true; }
public function __construct() { parent::__construct(); $jversion = new JVersion(); $this->config = RSFormProConfig::getInstance(); $this->isJ30 = $jversion->isCompatible('3.0'); }
/** * override method: get list image from articles. */ function getListByParameters($params) { if (JVersion::isCompatible('1.6.0')) { return $this->__getListJLOneSix($params); } return $this->__getListJLOneFive($params); }
function edit() { JEVHelper::stylesheet('eventsadmin.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/'); $document =& JFactory::getDocument(); $document->setTitle(JText::_('COM_JEVENTS_CONFIGURATION')); // Set toolbar items for the page JToolBarHelper::title(JText::_('COM_JEVENTS_CONFIGURATION'), 'jevents'); //APPLY BUTTON BY PRAKASH. JToolBarHelper::apply('params.apply'); //APPLY BUTTON JToolBarHelper::save('params.save'); JToolBarHelper::cancel('cpanel.cpanel'); $model = $this->getModel(); $this->params =& $model->getParams(); $component = JComponentHelper::getComponent(JEV_COM_COMPONENT); JHTML::_('behavior.tooltip'); if (JVersion::isCompatible("1.6.0")) { // Get the actions for the asset. $actions = JAccess::getActions(JEV_COM_COMPONENT, "component"); jimport('joomla.form.form'); // Add the search path for the admin component config.xml file. JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . JEV_COM_COMPONENT); // Get the form. $modelForm = $model->getForm(); $this->assignRef("form", $modelForm); } }
public function onBeforeRender() { if (JFactory::getApplication()->isAdmin()) { return; } $document = JFactory::getDocument(); if ($this->params->get('advanced')) { $document->addScriptDeclaration($this->advanced); } if (JVersion::isCompatible('3')) { JHtml::_('jquery.framework'); $document->addScript($this->js, 'text/javascript', false, true); return; } if ($this->params->get('jquery', 1)) { $jquery = '//ajax.googleapis.com/ajax/libs/jquery/' . $this->params->get('jquery_branch') . '/jquery.min.js'; if ($this->params->get('jquery_noconflict', 1)) { $jq[] = '<script src="' . $jquery . '"></script>'; $jq[] = '<script type="text/javascript">$.noConflict()</script>'; $jq[] = '<script src="' . $this->js . '"></script>'; $document->addCustomTag(implode(PHP_EOL, $jq)); } else { $document->addScript($jquery); $document->addScript($this->js, 'text/javascript', false, true); } } else { $document->addScript($this->js, 'text/javascript', false, true); } }
/** * This checks the compatibility testing method. * * @param string $input Version * @param bool $expect expected result of version check * @param string $message Test failure message * * @return void * @dataProvider casesCompatibility */ public function testIsCompatible( $input, $expect, $message ) { $this->assertThat( $expect, $this->equalTo($this->object->isCompatible($input)), $message ); }
function edit($tpl = null) { $document =& JFactory::getDocument(); // this already includes administrator $livesite = JURI::base(); if (JVersion::isCompatible("1.6.0")) { JEVHelper::stylesheet('eventsadmin16.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/'); } else { $document->addStyleSheet($livesite . 'components/' . JEV_COM_COMPONENT . '/assets/css/eventsadmin.css'); } $document->setTitle(JText::_('JEVENTS') . ' :: ' . JText::_('JEVENTS')); // Set toolbar items for the page JToolBarHelper::title(JText::_('JEV_EDIT_USER'), 'jevents'); JToolBarHelper::save("user.save"); JToolBarHelper::cancel("user.overview"); //JToolBarHelper::help( 'edit.user', true); $option = JRequest::getCmd('option', JEV_COM_COMPONENT); $db =& JFactory::getDBO(); $params =& JComponentHelper::getParams(JEV_COM_COMPONENT); if (JVersion::isCompatible("1.6.0")) { $rules = JAccess::getAssetRules("com_jevents", true); $creatorgroups = $rules->getData(); $creatorgroups = array_merge($creatorgroups["core.admin"]->getData(), $creatorgroups["core.create"]->getData()); $users = array(0); foreach ($creatorgroups as $creatorgroup => $permission) { if ($permission == 1) { $users = array_merge(JAccess::getUsersByGroup($creatorgroup, true), $users); } } $sql = "SELECT * FROM #__users where id IN (" . implode(",", array_values($users)) . ") ORDER BY name asc"; $db->setQuery($sql); $users = $db->loadObjectList(); } else { $minaccess = $params->getValue("jevcreator_level", 19); // get users AUTHORS and above $sql = "SELECT * FROM #__users where gid>=" . $minaccess; $db->setQuery($sql); $users = $db->loadObjectList(); } $userOptions[] = JHTML::_('select.option', '-1', 'Select User'); foreach ($users as $user) { $userOptions[] = JHTML::_('select.option', $user->id, $user->name . " ({$user->username})"); } $jevuser =& $this->get('user'); $userlist = JHTML::_('select.genericlist', $userOptions, 'user_id', 'class="inputbox" size="1" ', 'value', 'text', $jevuser->user_id); JLoader::register('JEventsCategory', JEV_ADMINPATH . "/libraries/categoryClass.php"); $categories = JEventsCategory::categoriesTree(); $lists['categories'] = JHTML::_('select.genericlist', $categories, 'categories[]', 'multiple="multiple" size="15"', 'value', 'text', explode("|", $jevuser->categories)); // get calendars $sql = "SELECT label as text, ics_id as value FROM #__jevents_icsfile where icaltype=2"; $db->setQuery($sql); $calendars = $db->loadObjectList(); $lists['calendars'] = JHTML::_('select.genericlist', $calendars, 'calendars[]', 'multiple="multiple" size="15"', 'value', 'text', explode("|", $jevuser->calendars)); $this->assignRef('lists', $lists); $this->assignRef("users", $userlist); $this->assignRef('jevuser', $jevuser); JHTML::_('behavior.tooltip'); }
public static function isJ($version) { static $cache = array(); if (!isset($cache[$version])) { $jversion = new JVersion(); $cache[$version] = $jversion->isCompatible($version); } return $cache[$version]; }
/** * adds additional fields to the user editing form * * @param JForm $form The form to be altered. * @param mixed $data The associated data for the form. * * @return boolean * * @since 1.6 */ public function onContentPrepareForm($form, $data) { $version = new JVersion(); if (!$version->isCompatible('3.4')) { return true; } if (!$form instanceof JForm) { $this->_subject->setError('JERROR_NOT_A_FORM'); return false; } $params = JComponentHelper::getParams('com_jce'); if ((bool) $params->get('replace_media_manager', 1) === false) { return; } // get form name. $name = $form->getName(); $valid = array('com_akrecipes.recipe', 'com_categories.categorycom_akrecipes', 'com_akrecipes.ingredient', 'com_akrecipes.brand', 'com_akrecipes.cuisine', 'com_akrecipes.brand', 'com_akrecipes.product'); // only allow some forms, see - https://github.com/joomla/joomla-cms/pull/8657 if (!in_array($name, $valid)) { return true; } $config = JFactory::getConfig(); $user = JFactory::getUser(); if ($user->getParam('editor', $config->get('editor')) !== "jce") { return true; } if (!JPluginHelper::getPlugin('editors', 'jce')) { return true; } $hasMedia = false; $fields = $form->getFieldset(); foreach ($fields as $field) { $type = $field->getAttribute('type'); if (strtolower($type) === "media") { // get filter value for field, eg: images, media, files $filter = $field->getAttribute('filter', 'images'); // get file browser link $link = $this->getLink($filter); // link not available for environment if (empty($link)) { continue; } $name = $field->getAttribute('name'); $group = (string) $field->group; $form->setFieldAttribute($name, 'link', $link, $group); $form->setFieldAttribute($name, 'class', 'input-large wf-media-input', $group); $hasMedia = true; } } if ($hasMedia) { // Include jQuery JHtml::_('jquery.framework'); $document = JFactory::getDocument(); $document->addScriptDeclaration('jQuery(document).ready(function($){$(".wf-media-input").removeAttr("readonly");});'); } return true; }
function fetchElement($name, $value, &$node, $control_name, $raw = false) { // Must load admin language files $lang =& JFactory::getLanguage(); $lang->load("com_jevents", JPATH_ADMINISTRATOR); $db =& JFactory::getDBO(); if (JVersion::isCompatible("1.6.0")) { $extension = $node->getAttribute('extension'); } else { $section = $node->attributes('section'); if (!isset($section)) { // alias for section $section = $node->attributes('scope'); if (!isset($section)) { $section = 'content'; } } } $class = $node->attributes('class'); if (!$class) { $class = "inputbox"; } $query = 'SELECT c.id, c.title as ctitle,p.title as ptitle, gp.title as gptitle, ggp.title as ggptitle, ' . ' CASE WHEN CHAR_LENGTH(p.title) THEN CONCAT_WS(" => ", p.title, c.title) ELSE c.title END as title' . ' FROM #__categories AS c' . ' LEFT JOIN #__categories AS p ON p.id=c.parent_id' . ' LEFT JOIN #__categories AS gp ON gp.id=p.parent_id ' . ' LEFT JOIN #__categories AS ggp ON ggp.id=gp.parent_id ' . ' WHERE c.published = 1 '; if (JVersion::isCompatible("1.6.0")) { $query .= ' AND c.extension = ' . $db->Quote($extension); } else { $query .= ' AND c.section = ' . $db->Quote($section); } $db->setQuery($query); $options = $db->loadObjectList(); echo $db->getErrorMsg(); foreach ($options as $key => $option) { $title = $option->ctitle; if (!is_null($option->ptitle)) { $title = $option->ptitle . "=>" . $title; } if (!is_null($option->gptitle)) { $title = $option->gptitle . "=>" . $title; } if (!is_null($option->ggptitle)) { $title = $option->ggptitle . "=>" . $title; } /* if (!is_null($option->gggptitle)){ $title = $option->gggptitle."=>".$title; } */ $options[$key]->title = $title; } JArrayHelper::sortObjects($options, "title"); if ($raw) { return $options; } else { array_unshift($options, JHTML::_('select.option', '0', '- ' . JText::_('JEV_SELECT_CATEGORY') . ' -', 'id', 'title')); return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="' . $class . '"', 'id', 'title', $value, $control_name . $name); } }
/** * Routine to hide submenu suing CSS since there are no paramaters for doing so without hiding the main menu * */ function _hideSubmenu() { // WHY THE HELL DO THEY BREAK PUBLIC FUNCTIONS !!! if (JVersion::isCompatible("1.6.0")) { JHTML::stylesheet('administrator/components/' . JEV_COM_COMPONENT . '/assets/css/hidesubmenu.css'); } else { JHTML::stylesheet('hidesubmenu.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/'); } }
/** * Called on installation * * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function install($adapter) { $adminpath = JPATH_SITE . '/administrator/components/com_extplorer'; com_install($adminpath); if (JVersion::isCompatible('3.0')) { rename($adminpath . '/extplorer.j30.php', $adminpath . '/extplorer.php'); } return true; }
function edit($tpl = null) { $document =& JFactory::getDocument(); include JEV_ADMINLIBS . "/editStrings.php"; $document->addScriptDeclaration($editStrings); // WHY THE HELL DO THEY BREAK PUBLIC FUNCTIONS !!! if (JVersion::isCompatible("1.6.0")) { JEVHelper::stylesheet('eventsadmin16.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/'); } else { JEVHelper::stylesheet('eventsadmin.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/'); } JEVHelper::script('editical.js', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/js/'); //JEVHelper::script('toolbarfix.js','components/'.JEV_COM_COMPONENT.'/assets/js/'); $document->setTitle(JText::_('EDIT_ICAL_EVENT')); // Set toolbar items for the page JToolBarHelper::title(JText::_('EDIT_ICAL_EVENT'), 'jevents'); $bar =& JToolBar::getInstance('toolbar'); if ($this->id > 0) { if ($this->editCopy) { $this->toolbarConfirmButton("icalevent.save", JText::_("save_copy_warning"), 'save', 'save', 'Save', false); if (JEVHelper::isEventEditor()) { $this->toolbarConfirmButton("icalevent.apply", JText::_("save_copy_warning"), 'apply', 'apply', 'Apply', false); } } else { $this->toolbarConfirmButton("icalevent.save", JText::_("save_icalevent_warning"), 'save', 'save', 'Save', false); if (JEVHelper::isEventEditor()) { $this->toolbarConfirmButton("icalevent.apply", JText::_("save_icalevent_warning"), 'apply', 'apply', 'Apply', false); } } } else { $this->toolbarButton("icalevent.save", 'save', 'save', 'Save', false); if (JEVHelper::isEventEditor()) { $this->toolbarButton("icalevent.apply", 'apply', 'apply', 'Apply', false); } } $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($params->get("editpopup", 0)) { $document->addStyleDeclaration("div#toolbar-box{margin:10px 10px 0px 10px;} div#jevents {margin:0px 10px 10px 10px;} "); $this->toolbarButton("icalevent.close", 'cancel', 'cancel', 'Cancel', false); JRequest::setVar('tmpl', 'component'); //force the component template } else { if ($this->id > 0) { $this->toolbarButton("icalevent.detail", 'cancel', 'cancel', 'Cancel', false); } else { $this->toolbarLinkButton("day.listevents", 'cancel', 'cancel', 'Cancel', false); } } JHTML::_('behavior.tooltip'); // I pass in the rp_id so that I can return to the repeat I was viewing before editing $this->assign("rp_id", JRequest::getInt("rp_id", 0)); $this->setCreatorLookup(); $this->_adminStart(); parent::displaytemplate($tpl); $this->_adminEnd(); }
/** * method to run before an install/update/uninstall method * * @param string $type 'install', 'update' or 'discover_install' * @param JInstallerAdapterComponent $parent Installerobject * * @return boolean false will terminate the installation */ public function preflight($type, $parent) { $min_version = (string) $parent->get('manifest')->attributes()->version; $jversion = new JVersion(); if (!$jversion->isCompatible($min_version)) { JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_CONTENT_BIBLELINK_XT_VERSION_UNSUPPORTED', $min_version), 'error'); return false; } return true; }
function __construct($config = array()) { parent::__construct($config); $this->registerDefaultTask('listevents'); JLoader::register('JEventsDefaultView', JEV_VIEWS . "/default/abstract/abstract.php"); if (!isset($this->_basePath) && JVersion::isCompatible("1.6.0")) { $this->_basePath = $this->basePath; $this->_task = $this->task; } }