function display($tpl = null) { $this->canDo = JCKHelper::getActions(); $this->app = JFactory::getApplication(); $this->user = JFactory::getUser(); $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) { JCKHelper::error(implode("\n", $errors)); return false; } // Check if there are no matching items if (!count($this->items)) { JCKHelper::error(JText::_('COM_JCK_LAYOUT_MANAGER_NO_TOOLBARS_FOUND')); } //now lets get default toolbars $editor = JPluginHelper::getPlugin('editors', 'jckeditor'); $params = new JRegistry($editor->params); $this->default = $params->get('toolbar', 'Publisher'); $this->defaultFT = $params->get('toolbar_ft', 'Basic'); $this->addToolbar(); parent::display($tpl); }
/** * Load the editor * * @access private * @param array Associative array of editor config paramaters * @since 1.5 */ function _loadEditor($config = array()) { //check if editor is already loaded if (!is_null($this->_editor)) { return; } jimport('joomla.filesystem.file'); // Build the path to the needed editor plugin $name = JFilterInput::clean($this->_name, 'cmd'); $path = JPATH_SITE . DS . 'plugins' . DS . 'editors' . DS . $name . '.php'; if (!JFile::exists($path)) { $message = JText::_('Cannot load the editor'); JCKHelper::error($message); return false; } // Require plugin file require_once $path; // Build editor plugin classname $name = 'plgEditor' . $this->_name; if ($this->_editor = new $name($this, $config)) { // load plugin parameters $this->initialise(); JPluginHelper::importPlugin('editors-xtd'); } }
/** * constructor * * @access protected * @param string The event handler */ function __construct($eventHandlerName) { $eventListenerClassName = 'JCK' . JString::ucfirst($eventHandlerName) . 'ControllerListener'; if (class_exists($eventListenerClassName)) { $this->_eventHandler = new $eventListenerClassName($this); } else { JCKHelper::error('No Event listener ' . $eventListenerClassName . ' class found.'); } }
function display($tpl = null) { $this->canDo = JCKHelper::getActions(); $this->app = JFactory::getApplication(); $this->user = JFactory::getUser(); $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); $this->params = $this->prepareForm($this->item); if (!$this->canDo->get('core.edit')) { $this->app->redirect(JRoute::_('index.php?option=com_jckman&view=list', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_EDIT'), 'error'); return false; } //end if //language $lang = JCKHelper::getLanguage(); $tag = $lang->getTag(); JFactory::$language = $lang; //override Joomla default language class $name = $this->item->name; $plugin = 'plg_jck' . $name; $pluginOverideFile = JPATH_COMPONENT . '/language/overrides/' . $tag . '.' . $plugin . '.ini'; $pluginLangFile = JPATH_COMPONENT . '/language/' . $tag . '/' . $tag . '.' . $plugin . '.ini'; if (JFile::exists($pluginOverideFile)) { //check in language overrides to see if user has installed an override language file $lang->loadFile($pluginOverideFile, $plugin); } else { if (JFile::exists($pluginLangFile)) { //load core language file if it exists $lang->load($plugin, JPATH_COMPONENT); } else { //load english default languge if (JFile::exists(JPATH_COMPONENT . '/language/en-GB/en-GB.plg_jck' . $name . '.ini')) { $lang->load($plugin, JPATH_COMPONENT, 'en-GB'); } } } $this->item->description = JText::_($this->item->description); $this->form->bind($this->item); // Check for errors. if (count($errors = $this->get('Errors'))) { JCKHelper::error(implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); }
function display($tpl = null) { $paths = new stdClass(); $paths->first = ''; $this->app = JFactory::getApplication(); $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->paths = $paths; // Check for errors. if (count($errors = $this->get('Errors'))) { JCKHelper::error(implode("\n", $errors)); return false; } $this->addToolbar(); JHTML::_('behavior.tooltip'); parent::display($tpl); }
function display($tpl = null) { $this->app = JFactory::getApplication(); $this->user = JFactory::getUser(); $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) { JCKHelper::error(implode("\n", $errors)); return false; } // Check if there are no matching items if (!count($this->items)) { JCKHelper::error(JText::_('COM_JCK_PLUGIN_NO_PLUGINS_FOUND')); } $this->addToolbar(); parent::display($tpl); }
public function __construct($default = array()) { parent::__construct($default); $app = JFactory::getApplication(); $this->_event_args = null; $name = $app->input->get('controller', ''); if (!$name) { $name = $app->input->get('view', $this->getName()); } $eventListenerFile = JPATH_COMPONENT . DS . 'event' . DS . $name . '.php'; jimport('joomla.filesystem.file'); if (JFile::exists($eventListenerFile)) { require_once $eventListenerFile; $this->editor_obervable = new JCKEditorObservable($name); } else { JCKHelper::error('No Event listener found for ' . $name . ' controller'); } //load style sheet $document = JFactory::getDocument(); $document->addStyleSheet(JCK_COMPONENT . '/css/header.css', 'text/css'); }
function display($tpl = null) { $paths = new stdClass(); $paths->first = ''; $this->canDo = JCKHelper::getActions(); $this->app = JFactory::getApplication(); $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->paths = $paths; if (!$this->canDo->get('jckman.install')) { $this->app->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_INSTALL'), 'error'); return false; } //end if // Check for errors. if (count($errors = $this->get('Errors'))) { JCKHelper::error(implode("\n", $errors)); return false; } JHTML::_('behavior.tooltip'); $this->addToolbar(); parent::display($tpl); }
protected static function &_load() { static $clean; if (isset($clean)) { return $clean; } $Itemid = JRequest::getInt('Itemid'); $app = JFactory::getApplication(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $lang = JFactory::getLanguage()->getTag(); $clientId = (int) $app->getClientId(); $cache = JFactory::getCache('com_modules', ''); $cacheid = md5(serialize(array('com_jckman', $groups, $clientId, $lang))); if (!($clean = $cache->get($cacheid))) { $db = JFactory::getDbo(); $query = $db->getQuery(true); //new JDatabaseQuery; $query->select('id, title, module, position, content, showtitle, params, mm.menuid'); $query->from('#__modules AS m'); $query->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = m.id'); $query->where('m.published = 1'); $date = JFactory::getDate(); $now = $date->toSQL(); $nullDate = $db->getNullDate(); $query->where('(m.publish_up = ' . $db->Quote($nullDate) . ' OR m.publish_up <= ' . $db->Quote($now) . ')'); $query->where('(m.publish_down = ' . $db->Quote($nullDate) . ' OR m.publish_down >= ' . $db->Quote($now) . ')'); $query->where('m.access IN (' . $groups . ')'); $query->where('m.client_id = ' . $clientId); $query->where('(mm.menuid = ' . (int) $Itemid . ' OR (mm.menuid <= 0 OR mm.menuid IS NULL))'); //fix as this is suppose to be a LEFT JOIN!!! // Filter by language if ($app->isSite() && $app->getLanguageFilter()) { $query->where('m.language IN (' . $db->Quote($lang) . ',' . $db->Quote('*') . ')'); } $query->order('position, ordering'); // Set the query $db->setQuery($query); if (!($modules = $db->loadObjectList())) { JCKHelper::error(JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $db->getErrorMsg())); return false; } // Apply negative selections and eliminate duplicates $negId = $Itemid ? -(int) $Itemid : false; $dupes = array(); $clean = array(); for ($i = 0, $n = count($modules); $i < $n; $i++) { $module =& $modules[$i]; // The module is excluded if there is an explicit prohibition, or if // the Itemid is missing or zero and the module is in exclude mode. $negHit = $negId === (int) $module->menuid || !$negId && (int) $module->menuid < 0; if (isset($dupes[$module->id])) { // If this item has been excluded, keep the duplicate flag set, // but remove any item from the cleaned array. if ($negHit) { unset($clean[$module->id]); } continue; } $dupes[$module->id] = true; // Only accept modules without explicit exclusions. if (!$negHit) { //determine if this is a custom module $file = $module->module; $custom = substr($file, 0, 4) == 'mod_' ? 0 : 1; $module->user = $custom; // Custom module name is given by the title field, otherwise strip off "com_" $module->name = $custom ? $module->title : substr($file, 4); $module->style = null; $module->position = strtolower($module->position); $clean[$module->id] = $module; } } unset($dupes); // Return to simple indexing that matches the query order. $clean = array_values($clean); $cache->store($clean, $cacheid); } return $clean; }
function beforeLoad(&$params) { $db = JFactory::getDBO(); $user = JFactory::getUser(); if ($user->authorise('core.admin')) { return; } $query = 'SELECT id,name,acl,parentid FROM #__jckplugins WHERE published = 1'; $db->setQuery($query); $plugins = $db->loadObjectList(); if (!is_array($plugins)) { JCKHelper::error($db->getErrorMsg()); } if (empty($plugins)) { return; } $groups = $user->getAuthorisedGroups(); $js = ''; $deniedPlugins = array(); $removePlugins = array(); foreach ($plugins as $plugin) { if (is_null($plugin->acl)) { continue; } $acl = json_decode($plugin->acl); $allow = true; if (empty($acl)) { $allow = false; $deniedPlugins[] = $plugin->id; $removePlugins[] = $plugin->name; } else { if ($groups) { $allow = false; for ($n = 0, $i = count($groups); $n < $i; $n++) { if (in_array($groups[$n], $acl)) { $allow = true; break; } //end if } //end for loop if (!$allow) { $deniedPlugins[] = $plugin->id; $removePlugins[] = $plugin->name; } } //end if // check to see if parent plugin access view level is denied. If is then parent settings override if ($allow && in_array($plugin->parentid, $deniedPlugins)) { $deniedPlugins[] = $plugin->id; $removePlugins[] = $plugin->name; } } } //var_dump($removePlugins); if (empty($removePlugins)) { return; } //lets create JS object $javascript = new JCKJavascript(); $plugs = implode(',', $removePlugins); $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t{\r\n\t\t\t\tif(editor.config.removePlugins) \r\n\t\t\t\t\teditor.config.removePlugins += '," . $plugs . "';\r\n\t\t\t\telse \t\r\n\t\t\t\t\teditor.config.removePlugins += '" . $plugs . "';\r\n\t\t\t});"); return $javascript->toRaw(); }
function beforeLoad(&$registry) { $db = JFactory::getDBO(); $query = 'SELECT * FROM #__jckplugins WHERE published = 1'; $db->setQuery($query); $plugins = $db->loadObjectList(); if (!is_array($plugins)) { JCKHelper::error($db->getErrorMsg()); } if (empty($plugins)) { return; } //lets create JS object $javascript = new JCKJavascript(); $script = "CKEDITOR.jckplugins = {"; foreach ($plugins as $plugin) { if (empty($plugin->params) || $plugin->params == '{}') { continue; } if ($plugin->iscore) { $params = new JCKParameter(trim($plugin->params), JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins' . DS . $plugin->name . '.xml'); } else { $params = new JCKParameter(trim($plugin->params), JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'plugins' . DS . $plugin->name . DS . $plugin->name . '.xml'); } $name = $plugin->name; $dialogName = $params->get('dialogname', ''); $title = $params->get('dialogtitle', ''); $height = $params->get('height', ''); $width = $params->get('width', ''); $resizable = $params->get('resizable', ''); if ($dialogName) { $name = $dialogName; } // overrwite plugin name with dialogname //lets get plugin Joomla configurable options if (trim(strtolower($title) == 'default')) { $title = ''; } $options = ''; $optionsXML = $params->getXML(); if (isset($optionsXML['options'])) { foreach ($optionsXML['options']->children() as $node) { $key = $node->attributes('name'); $default = $node->attributes('default'); $value = $params->get($key, $default); $handler = JCKConfigHandler::getInstance($node->attributes('type')); $options .= $handler->getOptions($key, $value, $default, $node, $params, $name); } } if ($options) { $options = substr($options, 0, -1); $options = '[' . $options . ']'; } else { $options = 'false'; } $script .= "{$name}:{'title':'{$title}','height':'{$height}','width':'{$width}','resizable':'{$resizable}','options': {$options}},"; } if ($script != "CKEDITOR.jckplugins = {") { $script = substr($script, 0, -1); } $script .= "};" . chr(13); $actionscript = "\r\n\r\n\t\tCKEDITOR.tools.removeSlashes = function(val)\r\n\t\t{\t\r\n\t\t\t val = val.replace(/(\\\"|\\\\')/g,'');\r\n\t\t return val;\r\n\t\t}\r\n\r\n\t\tCKEDITOR.on( 'dialogDefinition', function( ev )\r\n\t\t{\r\n\t\t\t// Take the dialog name and its definition from the event\r\n\t\t\t// data.\r\n\t\t\tvar dialogName = ev.data.name;\r\n\t\t\tvar dialogDefinition = ev.data.definition;\r\n\r\n\t\t\tif(CKEDITOR.jckplugins[dialogName ])\r\n\t\t\t{\r\n\t\t\t\tvar jckplugin = CKEDITOR.jckplugins[dialogName ];\r\n\r\n\t\t\t\tif(jckplugin.title) dialogDefinition.title = jckplugin.title;\r\n\t\t\t\tif(jckplugin.height) dialogDefinition.minHeight = jckplugin.height;\r\n\t\t\t\tif(jckplugin.width) dialogDefinition.minWidth = jckplugin.width;\r\n\t\t\t\tif(jckplugin.resizable) dialogDefinition.resizable = jckplugin.resizable;\r\n\r\n\t\t\t\tif(jckplugin.options)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var k = 0; k < jckplugin.options.length;k++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\teval('CKEDITOR.config.' + CKEDITOR.tools.removeSlashes(jckplugin.options[k]));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tfor(var m in CKEDITOR.jckplugins)\r\n\t\t{ \r\n\t\t\tvar jckplugin = CKEDITOR.jckplugins[m];\r\n\t\t\t\r\n\t\t\tif(jckplugin.options)\r\n\t\t\t{\r\n for(var n = 0; n < jckplugin.options.length;n++)\r\n\t\t\t\t{\r\n\t\t\t\t\teval('editor.config.' + CKEDITOR.tools.removeSlashes(jckplugin.options[n]));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t"; $javascript->addScriptDeclaration($script . $actionscript); return $javascript->toRaw(); }
function checkin() { // Check for request forgeries JRequest::checkToken() or die(JText::_('JINVALID_TOKEN')); if (!$this->canDo->get('core.edit.state')) { $this->setRedirect(JRoute::_('index.php?option=com_jckman&view=toolbars', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_CHECK'), 'error'); return false; } $db = JFactory::getDBO(); $user = JFactory::getUser(); $app = JFactory::getApplication(); $cid = $app->input->get('cid', array(0), 'array'); $sql = $db->getQuery(true); JArrayHelper::toInteger($cid, array(0)); if (count($cid) < 1) { JCKHelper::error(JText::_('COM_JCKMAN_TOOLBAR_NO_CHECKIN')); } $cids = implode(',', $cid); $sql->update('#__jcktoolbars')->set(array('checked_out = 0', 'checked_out_time = "0000-00-00 00:00:00"'))->where('id IN ( ' . $cids . ' )')->where('checked_out = ' . (int) $user->get('id')); $db->setQuery($sql); if (!$db->query()) { JCKHelper::error($db->getErrorMsg()); } $this->event_args = array('cid' => $cid, 'value' => true); $plural = count($cid) > 1 ? '(s)' : ''; JCKHelper::error(JText::sprintf('COM_JCKMAN_TOOLBAR_CHECKIN', (int) count($cid), $plural), 'message'); $this->setRedirect(JRoute::_('index.php?option=com_jckman&view=' . $app->input->get('view', 'toolbars'), false)); }
/** * Install an extension from a directory * * @static * @return boolean True on success * @since 1.0 */ protected function _getPackageFromFolder() { // Get the path to the package to install $p_dir = JRequest::getString('install_directory'); $p_dir = JPath::clean($p_dir); // Did you give us a valid directory? if (!is_dir($p_dir)) { JCKHelper::error(JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY')); return false; } // Detect the package type $type = JInstallerHelper::detectType($p_dir); // Did you give us a valid package? if (!$type) { JCKHelper::error(JText::_('COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE')); return false; } $package['packagefile'] = null; $package['extractdir'] = null; $package['dir'] = $p_dir; $package['type'] = $type; return $package; }
function getSelectedToolbarList() { $rows = array(); jckimport('helper'); $toolbars = JCKHelper::getEditorToolbars(); $cid = JRequest::getVar('cid', array(0), '', 'array'); JArrayHelper::toInteger($cid, array(0)); $db = JFactory::getDBO(); $sql = $db->getQuery(true); $sql->select('title')->from('#__jckplugins')->where('id = ' . $cid[0]); $pluginname = $db->setQuery($sql)->loadResult(); if (!!$pluginname && !is_string($pluginname)) { JCKHelper::error($db->getErrorMsg()); } jckimport('helper'); $toolbarnames = JCKHelper::getEditorToolbars(); if (!empty($toolbarnames)) { require_once CKEDITOR_LIBRARY . DS . 'toolbar.php'; $CKfolder = CKEDITOR_LIBRARY . DS . 'toolbar'; foreach ($toolbarnames as $toolbarname) { $tmpfilename = $CKfolder . DS . $toolbarname . '.php'; require_once $tmpfilename; $classname = 'JCK' . ucfirst($toolbarname); $toolbar = new $classname(); $pluginTitle = str_replace(' ', '', $pluginname); //$pluginTitle = ucfirst($pluginTitle); leave it to plugin XML to captialize titile if (!isset($toolbar->{$pluginTitle})) { continue; } $row = new stdclass(); $row->text = $toolbarname; $row->value = $toolbarname; $rows[] = $row; } } return $rows; }
public function onExport() { ini_set('max_execution_time', 5000); //require(JPATH_COMPONENT.'/helpers/archive.php'); require JPATH_COMPONENT . '/helpers/archivefactory.php'; //copy XML file jimport('joomla.filesystem.file'); $src = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor.xml'; $dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins' . DS . 'jckeditor.xml'; if (!JFile::copy($src, $dest)) { $this->app->enqueueMessage(JText::_('COM_JCKMAN_CPANEL_UNABLE_TO_COPY_MANIFEST')); } $src = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'toolbar'; $dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'toolbar'; if (!JFolder::copy($src, $dest, '', true)) { $this->app->enqueueMessage(JText::_('COM_JCKMAN_CPANEL_UNABLE_TO_COPY_TOOLBARS')); } $src = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'language' . DS . 'overrides'; $dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'overrides'; if (!JFolder::copy($src, $dest, '', true)) { $this->app->enqueueMessage(JText::_('COM_JCKMAN_CPANEL_UNABLE_TO_COPY_TOOLBARS')); } //process SQL if ($this->_createSQL()) { // Create a new gzip file test.tgz in htdocs/test $backup_file_name = 'bak_jckeditor' . date('dmyHis'); /* $tgz = new gzip_file($backup_file_name); $tgz->set_options(array('basedir' => JPATH_COMPONENT."/editor", 'overwrite' =>1,'inmemory'=>1,level=>5)); $tgz->add_files('import.xml'); $tgz->add_files('toolbar'); $tgz->add_files('plugins'); $tgz->create_archive(); $tgz->download_file(); exit; */ $tgz = new ArchiveFactory(JPATH_COMPONENT . "/editor", $backup_file_name); $tgz->downloadFile(); } else { JCKHelper::error(JText::_("COM_JCKMAN_CPANEL_COULD_NOT_CREATE_SQL")); } }
/** * Tries to find the package manifest file * * @return boolean True on success, False on error * * @since 11.1 */ public function findManifest() { // Get an array of all the XML files from the installation directory $xmlfiles = JFolder::files($this->getPath('source'), '.xml$', 1, true); // If at least one XML file exists if (!empty($xmlfiles)) { foreach ($xmlfiles as $file) { // Is it a valid Joomla installation manifest file? $manifest = $this->isManifest($file); if (!is_null($manifest)) { // If the root method attribute is set to upgrade, allow file overwrite if ((string) $manifest->attributes()->method == 'upgrade') { $this->upgrade = true; $this->overwrite = true; } // If the overwrite option is set, allow file overwriting if ((string) $manifest->attributes()->overwrite == 'true') { $this->overwrite = true; } // Set the manifest object and path $this->manifest = $manifest; $this->setPath('manifest', $file); // Set the installation source path to that of the manifest file $this->setPath('source', dirname($file)); return true; } } // None of the XML files found were valid install files JCKHelper::error(JText::_('JLIB_INSTALLER_ERROR_NOTFINDJOOMLAXMLSETUPFILE')); return false; } else { // No XML files were found in the install folder JCKHelper::error(JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE')); return false; } }
/** * Handles an XML parsing error * * @param integer $code XML Error Code. * @param integer $line Line on which the error happened. * @param integer $col Column on which the error happened. * * @return void * * @deprecated 12.1 * @since 11.1 * * @deprecated 12.1 Use PHP Exception */ protected function _handleError($code, $line, $col) { JCKHelper::error('XML Parsing Error at ' . $line . ':' . $col . '. Error ' . $code . ': ' . xml_error_string($code)); }
function _createEditorToolbar($id, $name, $oldname) { require_once CKEDITOR_LIBRARY . DS . 'toolbar.php'; $CKfolder = CKEDITOR_LIBRARY . DS . 'toolbar'; $newfilename = $CKfolder . DS . $name . '.php'; $oldfilename = $CKfolder . DS . $oldname . '.php'; $classname = 'JCK' . ucfirst($name); $toolbar = new stdclass(); $toolbarConfig = new JRegistry('toolbar'); $db = JFactory::getDBO(); $query = 'SELECT tp.pluginid AS id,p.title,tp.row' . ' FROM #__jcktoolbarplugins tp' . ' LEFT JOIN #__jckplugins p ON p.id = tp.pluginid' . ' WHERE tp.state = 1' . ' AND tp.toolbarid = ' . $id . ' ORDER BY tp.row ASC,tp.ordering ASC'; $db->setQuery($query); $toolbarplugins = $db->loadObjectList(); if ($toolbarplugins) { foreach ($toolbarplugins as $plugin) { if ($plugin->id < 0) { $property = 'brk_' . $plugin->id * -1; $toolbar->{$property} = $plugin->row; } else { $property = $plugin->title; $toolbar->{$property} = $plugin->row; } } } $toolbarConfig->loadObject($toolbar); // Get the config registry in PHP class format and write it to file $buffer = $toolbarConfig->toString('PHP', array('class' => $classname . ' extends JCKToolbar')); if (!JFile::write($oldfilename, $buffer)) { JCKHelper::error(JText::sprintf('COM_JCKMAN_LAYOUT_MANAGER_FAILED_WRITE_FILE', $classname)); } if ($newfilename != $oldfilename) { if (!JFile::move($oldfilename, $newfilename)) { JCKHelper::error(JText::sprintf('COM_JCKMAN_LAYOUT_MANAGER_FAILED_WRITE_FILE', $classname)); } } }
function _loadItems() { return JCKHelper::error(JText::_('Method Not Implemented')); }
/** * Custom uninstall method * * @access public * @param int $cid The id of the plugin to uninstall * @param int $clientId The id of the client (unused) * @return boolean True on success * @since 1.5 */ function uninstall($id) { // Initialize variables $row = null; $retval = true; $db =& $this->parent->getDBO(); // First order of business will be to load the module object table from the database. // This should give us the necessary information to proceed. // ^ Changes to plugin parameters. Use JCK Plugins Table class. $row =& JTable::getInstance('plugin', 'JCKTable'); $row->load((int) $id); // Is the plugin we are trying to uninstall a core one? // Because that is not a good idea... if ($row->iscore) { JCKHelper::error('Plugin Uninstall: ' . JText::sprintf('WARNCOREPLUGIN', $row->title) . "<br />" . JText::_('WARNCOREPLUGIN2')); return false; } // Get the plugin folder so we can properly build the plugin path if (trim($row->name) == '') { JCKHelper::error(JText::_('COM_JCKMAN_ADAPTER_PLUGIN_FIELD_EMPTY')); return false; } //Now delete dependencies $sql = $db->getQuery(true); $sql->delete('#__jcktoolbarplugins')->where('pluginid =' . $row->id); if (!$db->setQuery($sql)->query()) { JCKHelper::error($db->getErrorMsg()); } // Set the plugin root path $this->parent->setPath('extension_root', JCK_PLUGINS . DS . $row->name); $manifestFile = $this->parent->getPath('extension_root') . DS . $row->name . '.xml'; if (file_exists($manifestFile)) { // If we cannot load the xml file return null if (!($xml = JFactory::getXML($manifestFile))) { JCKHelper::error(JText::_('COM_JCKMAN_ADAPTER_UNINSTALL_COULD_NOT_LOAD_MANIFEST')); return false; } $pname = (string) $xml->attributes()->plugin; if ((string) $xml->scriptfile) { $manifestScript = (string) $xml->scriptfile; $manifestScriptFile = $this->parent->getPath('extension_root') . DS . $manifestScript; if (is_file($manifestScriptFile)) { // load the file include_once $manifestScriptFile; } // Set the class name $classname = 'plgJCK' . $pname . 'InstallerScript'; if (class_exists($classname)) { // create a new instance $this->parent->manifestClass = new $classname($this); // and set this so we can copy it later $this->set('manifest_script', $manifestScript); // Note: if we don't find the class, don't bother to copy the file } // run preflight if possible ob_start(); ob_implicit_flush(false); if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'preflight')) { if ($this->parent->manifestClass->preflight('uninstall', $this) === false) { // Install failed, rollback changes $this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_CUSTOM_ABORT')); return false; } } ob_end_clean(); ob_start(); ob_implicit_flush(false); if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'uninstall')) { $this->parent->manifestClass->uninstall($this); } $msg = ob_get_contents(); // append messages ob_end_clean(); } /** * * Remove plugin from toolbars file AW * */ $CKfolder = CKEDITOR_LIBRARY . DS . 'toolbar'; $toolbarnames =& JCKHelper::getEditorToolbars(); foreach ($toolbarnames as $toolbarname) { $tmpfilename = $CKfolder . DS . $toolbarname . '.php'; require_once $tmpfilename; $classname = 'JCK' . ucfirst($toolbarname); $toolbar = new $classname(); $pluginTitle = str_replace(' ', '', $row->title); $pluginTitle = ucfirst($pluginTitle); if (!isset($toolbar->{$pluginTitle})) { continue; } //fix toolbar values or they will get wiped out foreach (get_object_vars($toolbar) as $k => $v) { if (is_null($v)) { $toolbar->{$k} = ''; } if ($k[0] == '_') { $toolbar->{$k} = NULL; } } $toolbar->{$pluginTitle} = NULL; $toolbarConfig = new JRegistry('toolbar'); $toolbarConfig->loadObject($toolbar); // Get the config registry in PHP class format and write it to configuation.php if (!JFile::write($tmpfilename, $toolbarConfig->toString('PHP', array('class' => $classname . ' extends JCKToolbar')))) { JCKHelper::error(JText::sprintf('COM_JCKMAN_ADAPTER_FAILED_TO_REMOVE_PLUGIN_TOOLBAR', $row->name, $classname)); } } /** * * Remove plugin from config file AW * */ $config =& JCKHelper::getEditorPluginConfig(); $config->set($row->name, NULL); // remove value from output $cfgFile = CKEDITOR_LIBRARY . DS . 'plugins' . DS . 'toolbarplugins.php'; // Get the config registry in PHP class format and write it to configuation.php if (!JFile::write($cfgFile, $config->toString('PHP', array('class' => 'JCKToolbarPlugins extends JCKPlugins')))) { JCKHelper::error(JText::sprintf('COM_JCKMAN_ADAPTER_FAILED_TO_REMOVE_PLUGIN_FROM_CONFIG', $pname)); } $root =& $xml; if ($root->getName() != 'extension' && $root->getName() != 'install') { JCKHelper::error(JText::_('COM_JCKMAN_ADAPTER_UNINSTALL_INVALID_MANIFEST')); return false; } // Remove the plugin files $this->parent->removeFiles($root->files, -1); JFile::delete($manifestFile); // Remove all media and languages as well $this->parent->removeFiles($root->languages, 0); } else { JCKHelper::error(Jtext::_('COM_JCKMAN_ADAPTER_UNINSTALL_INVALID_MANIFEST_OR_NOT_FOUND')); $row->delete($row->id); unset($row); $retval = false; } if ($row) { // Now we will no longer need the plugin object, so lets delete it $row->delete($row->id); unset($row); } // If the folder is empty, let's delete it $files = JFolder::files($this->parent->getPath('extension_root')); if (!count($files)) { JFolder::delete($this->parent->getPath('extension_root')); } //Now delete copy of plugin stored in the component $copyPath = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins' . DS . $pname; JFolder::delete($copyPath); return $retval; }
function update($parent) { $this->install($parent); $db = JFactory::getDBO(); if (method_exists($parent, 'extension_root')) { $sqlfile = $parent->getPath('extension_root') . DS . 'sql' . DS . 'install.sql'; } else { $sqlfile = $parent->getParent()->getPath('extension_root') . DS . 'sql' . DS . 'install.sql'; } // Don't modify below this line $buffer = file_get_contents($sqlfile); if ($buffer !== false) { jimport('joomla.installer.helper'); $queries = JInstallerHelper::splitSql($buffer); if (count($queries) != 0) { foreach ($queries as $query) { $query = trim($query); if ($query != '' && $query[0] != '#') { $db->setQuery($query); if (!$db->query()) { if (!class_exists('JCKHelper')) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helper.php'; } JCKHelper::error(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true))); return false; } } } } } }
/** * Custom install method * * @access public * @return boolean True on success * @since 1.5 * Minor alteration - see below */ function install() { // Get a database connector object $db = $this->parent->getDBO(); // Get the extension manifest object $manifest = $this->parent->getManifest(); $this->manifest = $manifest; //$manifest->document; /** * --------------------------------------------------------------------------------------------- * Manifest Document Setup Section * --------------------------------------------------------------------------------------------- */ // Set the component name $name = ''; if ($this->manifest->name) { $name = (string) $this->manifest->name; $this->set('name', $name); } else { $this->set('name', ''); } // Get the component description $description = (string) $this->manifest->description; if (is_a($description, 'JXMLElement')) { $this->parent->set('message', $description); } else { $this->parent->set('message', ''); } $element = $this->manifest->files; // Plugin name is specified $pname = (string) $this->manifest->attributes()->plugin; if (!empty($pname)) { // ^ Use JCK_PLUGINS defined path $this->parent->setPath('extension_root', JCK_PLUGINS . DS . $pname); } else { $this->parent->abort('Extension Install: ' . JText::_('COM_JCKMAN_ADAPTER_NO_PLUGIN_SPECIFIED')); return false; } if ((string) $manifest->scriptfile) { $manifestScript = (string) $manifest->scriptfile; $manifestScriptFile = $this->parent->getPath('source') . DS . $manifestScript; if (is_file($manifestScriptFile)) { // load the file include_once $manifestScriptFile; } // Set the class name $classname = 'plgJCK' . $pname . 'InstallerScript'; if (class_exists($classname)) { // create a new instance $this->parent->manifestClass = new $classname($this); // and set this so we can copy it later $this->set('manifest_script', $manifestScript); // Note: if we don't find the class, don't bother to copy the file } // run preflight if possible ob_start(); ob_implicit_flush(false); if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'preflight')) { if ($this->parent->manifestClass->preflight('install', $this) === false) { // Install failed, rollback changes $this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_CUSTOM_ABORT')); return false; } } ob_end_clean(); } /** * --------------------------------------------------------------------------------------------- * Filesystem Processing Section * --------------------------------------------------------------------------------------------- */ // If the extension directory does not exist, lets create it $created = false; if (!file_exists($this->parent->getPath('extension_root'))) { if (!($created = JFolder::create($this->parent->getPath('extension_root')))) { $this->parent->abort(JText::sprintf('COM_JCKMAN_ADAPTER_PLUGIN_FAILED_CREATE_DIRECTORY', $this->parent->getPath('extension_root'))); return false; } } /* * If we created the extension directory and will want to remove it if we * have to roll back the installation, lets add it to the installation * step stack */ if ($created) { $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); } // Copy all necessary files if ($this->parent->parseFiles($element, -1) === false) { // Install failed, roll back changes $this->parent->abort(); return false; } // Parse optional tags -- language files for plugins if ($this->_parseLanguages($this->manifest->languages) === false) { // Install failed, roll back changes $this->parent->abort(); return false; } // If there is an install file, lets copy it. $installScriptElement = (string) $this->manifest->installfile; if (is_a($installScriptElement, 'JXMLElement')) { // Make sure it hasn't already been copied (this would be an error in the xml install file) if (!file_exists($this->parent->getPath('extension_root') . DS . $installScriptElement)) { $path['src'] = $this->parent->getPath('source') . DS . $installScriptElement; $path['dest'] = $this->parent->getPath('extension_root') . DS . $installScriptElement; if (!$this->parent->copyFiles(array($path))) { // Install failed, rollback changes $this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_COMPONENT') . ' ' . JText::_('COM_JCKMAN_ADAPTER_INSTALL') . ': ' . JText::_('COM_JCKMAN_ADAPTER_COULD_NOT_COPY_INSTALL_FILE')); return false; } } $this->set('install.script', $installScriptElement); } // If there is an uninstall file, lets copy it. $uninstallScriptElement = (string) $this->manifest->uninstallfile; if (is_a($uninstallScriptElement, 'JXMLElement')) { // Make sure it hasn't already been copied (this would be an error in the xml install file) if (!file_exists($this->parent->getPath('extension_root') . DS . $uninstallScriptElement)) { $path['src'] = $this->parent->getPath('source') . DS . $uninstallScriptElpement; $path['dest'] = $this->parent->getPath('extension_root') . DS . $uninstallScriptElement; if (!$this->parent->copyFiles(array($path))) { // Install failed, rollback changes $this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_COMPONENT') . ' ' . JText::_('COM_JCKMAN_ADAPTER_INSTALL') . ': ' . JText::_('COM_JCKMAN_ADAPTER_COULD_NOT_COPY_INSTALL_FILE')); return false; } } } /** * --------------------------------------------------------------------------------------------- * Database Processing Section * --------------------------------------------------------------------------------------------- */ // Check to see if a plugin by the same name is already installed // ^ Altered db query for #__JCK_PLUGINS $query = 'SELECT `id`' . ' FROM `#__jckplugins`' . ' WHERE name = ' . $db->Quote($pname); $db->setQuery($query); if (!$db->Query()) { // Install failed, roll back changes $this->parent->abort('Plugin Install: ' . $db->stderr(true)); return false; } $id = $db->loadResult(); // Was there a module already installed with the same name? if ($id) { $row = JTable::getInstance('plugin', 'JCKTable'); $row->load($id); } else { $icon = $this->manifest->icon; // ^ Changes to plugin parameters. Use JCK Plugins Table class. $row = JTable::getInstance('plugin', 'JCKTable'); $row->title = $this->get('name'); $row->name = $pname; $row->type = 'plugin'; $row->row = 4; $row->published = 1; $row->editable = 1; $row->icon = $icon ? (string) $icon : ''; $row->iscore = 0; $row->params = $this->parent->getParams(); if ($this->manifest->attributes()->parent) { $parentName = (string) $this->manifest->attributes()->parent; $row->setParent($parentName); } if (!$row->store()) { // Install failed, roll back changes $this->parent->abort('Plugin Install: ' . $db->stderr(true)); return false; } // Since we have created a plugin item, we add it to the installation step stack // so that if we have to rollback the changes we can undo it. $this->parent->pushStep(array('type' => 'plugin', 'id' => $row->id)); } /* ------------------------------------------------------------------------------------------- * update editor plugin config file AW * ------------------------------------------------------------------------------------------- */ $config = JCKHelper::getEditorPluginConfig(); if ($config->get($pname, false) === false) { $config->set($pname, 1); $cfgFile = CKEDITOR_LIBRARY . DS . 'plugins' . DS . 'toolbarplugins.php'; // Get the config registry in PHP class format and write it to configuation.php if (!JFile::write($cfgFile, $config->toString('PHP', array('class' => 'JCKToolbarPlugins extends JCKPlugins')))) { JCKHelper::error('Failed to publish ' . $pname . ' jckeditor plugin'); } $config = JCKHelper::getEditorPluginConfig(); } /** * --------------------------------------------------------------------------------------------- * Custom Installation Script Section * --------------------------------------------------------------------------------------------- */ /* * If we have an install script, lets include it, execute the custom * install method, and append the return value from the custom install * method to the installation message. */ if ($this->get('install.script')) { if (is_file($this->parent->getPath('extension_root') . DS . $this->get('install.script'))) { ob_start(); ob_implicit_flush(false); require_once $this->parent->getPath('extension_root') . DS . $this->get('install.script'); if (function_exists('com_install')) { if (com_install() === false) { $this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_PLUGIN_CUSTOM_INSTALL_ROUTINE_FAILURE')); return false; } } $msg = ob_get_contents(); ob_end_clean(); if ($msg != '') { $this->parent->set('extension.message', $msg); } } } /** * --------------------------------------------------------------------------------------------- * Finalization and Cleanup Section * --------------------------------------------------------------------------------------------- */ // Lastly, we will copy the manifest file to its appropriate place. if (!$this->parent->copyManifest(-1)) { // Install failed, rollback changes $this->parent->abort('Plugin Install: ' . JText::_('COM_JCKMAN_ADAPTER_NOT_COPY_SETUP_FILE')); return false; } // And now we run the postflight ob_start(); ob_implicit_flush(false); if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'postflight')) { $this->parent->manifestClass->postflight('install', $this); } ob_end_clean(); return true; }
/** * Method to detect the extension type from a package directory * * @param string $p_dir Path to package directory * * @return mixed Extension type string or boolean false on fail * * @since 11.1 */ public static function detectType($p_dir) { // Search the install dir for an XML file $files = JFolder::files($p_dir, '\\.xml$', 1, true); if (!count($files)) { JCKHelper::error(JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE')); return false; } foreach ($files as $file) { if (!($xml = JCKHelper::getXML($file))) { continue; } if ($xml->getName() != 'extension' && $xml->getName() != 'install') { unset($xml); continue; } $type = (string) $xml->attributes()->type; // Free up memory unset($xml); return $type; } JCKHelper::error(JText::_('JLIB_INSTALLER_ERROR_NOTFINDJOOMLAXMLSETUPFILE')); // Free up memory. unset($xml); return false; }
function onPublish($cid, $value) { if (!$this->canDo->get('core.edit.state')) { $this->app->redirect(JRoute::_('index.php?option=com_jckman&view=list', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_PUB'), 'error'); return false; } $db = JFactory::getDBO(); $user = JFactory::getUser(); $cids = implode(',', $cid); $query = 'SELECT name FROM #__jckplugins' . ' WHERE id IN ( ' . $cids . ' )' . ' AND ( checked_out = 0 OR ( checked_out = ' . (int) $user->get('id') . ' ))'; $db->setQuery($query); $pluginnames = $db->loadColumn(); if (!$pluginnames) { JCKHelper::error($db->getErrorMsg()); } jckimport('helper'); $config = JCKHelper::getEditorPluginConfig(); foreach ($pluginnames as $pname) { $config->set($pname, $value); } $cfgFile = CKEDITOR_LIBRARY . DS . 'plugins' . DS . 'toolbarplugins.php'; // Get the toolbar registry in PHP class format and write it to file $buffer = $config->toString('PHP', array('class' => 'JCKToolbarPlugins extends JCKPlugins')); if (!JFile::write($cfgFile, $buffer)) { $modify = $value ? 'publish ' : 'unpublish '; JCKHelper::error(JText::sprintf('COM_JCK_PLUGIN_LIST_FAILED_TO_PUBLISH_UNPUBLISH_PLUGINS', $modify)); } }
/** * Remove (uninstall) an extension * * @param array An array of identifiers * @return boolean True on success * @since 1.5 */ function remove($eid = array()) { // Initialise variables. $user = JFactory::getUser(); if ($user->authorise('core.delete', 'com_installer')) { // Initialise variables. $failed = array(); /* * Ensure eid is an array of extension ids in the form id => client_id * TODO: If it isn't an array do we want to set an error and fail? */ if (!is_array($eid)) { $eid = array($eid => 0); } // Get a database connector $db = JFactory::getDBO(); // Get an installer object for the extension type jimport('joomla.installer.installer'); $installer = JInstaller::getInstance(); $row = JTable::getInstance('extension'); // Uninstall the chosen extensions foreach ($eid as $id) { $id = trim($id); $row->load($id); if ($row->type) { $result = $installer->uninstall($row->type, $id); // Build an array of extensions that failed to uninstall if ($result === false) { $failed[] = $id; } } else { $failed[] = $id; } } $langstring = 'COM_INSTALLER_TYPE_TYPE_' . strtoupper($row->type); $rowtype = JText::_($langstring); if (strpos($rowtype, $langstring) !== false) { $rowtype = $row->type; } if (count($failed)) { // There was an error in uninstalling the package $msg = JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype); $result = false; } else { // Package uninstalled sucessfully $msg = JText::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS', $rowtype); $result = true; } $app = JFactory::getApplication(); $app->enqueueMessage($msg); $this->setState('action', 'remove'); $this->setState('name', $installer->get('name')); $app->setUserState('com_installer.message', $installer->message); $app->setUserState('com_installer.extension_message', $installer->get('extension_message')); return $result; } else { $result = false; JCKHelper::error(JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); } }
function display($tpl = null) { $this->canDo = JCKHelper::getActions(); $this->app = JFactory::getApplication(); $this->user = JFactory::getUser(); $this->item = ''; $cid = $this->app->input->get('cid', array(), 'array'); JArrayHelper::toInteger($cid, array(0)); if (!count($cid) && !$this->canDo->get('core.create')) { $this->app->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_CREATE'), 'error'); return false; } elseif (!$this->canDo->get('core.edit')) { $this->app->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_EDIT'), 'error'); return false; } //end if $lists = array(); $this->item = JCKHelper::getTable('toolbar'); // load the row from the db table $this->item->load(isset($cid[0]) ? $cid[0] : 0); // fail if checked out not by 'me' if ($this->item->isCheckedOut($this->user->get('id'))) { $msg = JText::sprintf('COM_JCKMAN_MSG_BEING_EDITED', JText::_('The toolbar'), $this->item->title); $this->app->redirect(JRoute::_('index.php?option=com_jckman&view=toolbars', false), $msg, 'error'); return false; } if (isset($cid[0])) { $this->item->checkout($this->user->get('id')); //now lets get default toolbars $editor = JPluginHelper::getPlugin('editors', 'jckeditor'); $params = new JRegistry($editor->params); $this->default = $params->get('toolbar', 'full'); $this->defaultFT = $params->get('toolbar_ft', 'full'); if (strtolower($this->item->name) == strtolower($this->default) || strtolower($this->item->name) == strtolower($this->defaultFT)) { $this->item->default = true; } else { $this->item->default = false; } } else { $this->item->params = ''; $this->item->default = false; } $db = JFactory::getDBO(); //set the default total number of plugin records $total = 0; $totalRows = 0; if (isset($cid[0])) { $total = 1; $sql = $db->getQuery(true); $sql->select('p.id,p.name,p.title,p.icon,tp.row')->from('#__jckplugins p')->join('INNER', '#__jcktoolbarplugins tp ON tp.pluginid = p.id')->join('LEFT', '#__jckplugins parent on parent.id = p.parentid')->where('tp.state = 1')->where('tp.toolbarid = ' . (int) $this->item->id)->where('p.published = 1')->where('(p.parentid IS NULL OR parent.published = 1)')->order('tp.toolbarid ASC,tp.row ASC,tp.ordering ASC'); $toolbarplugins = $db->setQuery($sql)->loadObjectList(); // get the total number of core plugin records $sql = $db->getQuery(true); $sql->select('COUNT(*)')->from('#__jcktoolbarplugins tp')->join('INNER', '#__jckplugins p ON tp.pluginid = p.id')->join('LEFT', '#__jckplugins parent on parent.id = p.parentid')->where('tp.toolbarid =' . (int) $this->item->id)->where('p.iscore = 1'); $totalRows = $db->setQuery($sql)->loadResult(); if (!$totalRows) { require_once CKEDITOR_LIBRARY . DS . 'toolbar.php'; $CKfolder = CKEDITOR_LIBRARY . DS . 'toolbar'; $filename = $CKfolder . DS . $this->item->name . '.php'; require $filename; $classname = 'JCK' . ucfirst($this->item->name); $toolbar = new $classname(); $sql = $db->getQuery(true); $sql->select('p.id, p.title')->from('#__jckplugins p')->join('LEFT', '#__jckplugins parent on parent.id = p.parentid')->where('p.title != ""')->where('p.published = 1')->where('p.iscore = 1')->where('(p.parentid IS NULL OR parent.published = 1)'); $allplugins = $db->setQuery($sql)->loadObjectList(); $values = array(); //fix toolbar values or they will get wiped out $l = 1; $n = 1; $j = 1; foreach (get_object_vars($toolbar) as $k => $v) { if ($v) { $n = $n > $v ? $n : $v; } if ($l < $n) { $l = $n; $j = 1; } for ($m = 0; $m < count($allplugins); $m++) { if ($k == $allplugins[$m]->title) { $values[] = '(' . (int) $this->item->id . ',' . (int) $allplugins[$m]->id . ',' . $n . ',' . $j . ',1)'; break; } if (strpos($k, 'brk_') !== false) { $id = preg_match('/[0-9]+$/', $k); $id = $id * -1; $values[] = '(' . (int) $this->item->id . ',' . $id . ',' . $n . ',' . $j . ',1)'; $n++; break; } } $j++; } if (!empty($values)) { $query = 'INSERT INTO #__jcktoolbarplugins(toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',', $values); $db->setQuery($query); if (!$db->query()) { JCKHelper::error($db->getErrorMsg()); } } } $sql = $db->getQuery(true); $sql->select('p.id,p.name,p.title,p.icon,p.row')->from('#__jckplugins p')->join('LEFT', '#__jcktoolbarplugins tp ON tp.pluginid = p.id AND tp.toolbarid = ' . (int) $this->item->id)->join('LEFT', '#__jckplugins parent on parent.id = p.parentid')->where('tp.pluginid is null')->where('p.published = 1')->where('p.title != ""')->where('p.iscore = 1')->where('(p.parentid IS NULL OR parent.published = 1)')->order('p.row ASC, p.id ASC'); $plugins = $db->setQuery($sql)->loadObjectList(); $sql = $db->getQuery(true); $sql->select('tp.pluginid AS id,p.name,p.title,p.icon,tp.row')->from('#__jcktoolbarplugins tp')->join('LEFT', '#__jckplugins p ON tp.pluginid = p.id AND p.published = 1')->join('LEFT', '#__jckplugins parent on parent.id = p.parentid AND parent.published = 1')->where('tp.state = 1')->where('tp.toolbarid = ' . (int) $this->item->id)->where('(p.parentid IS NULL OR parent.published = 1)')->order('tp.toolbarid ASC,tp.row ASC,tp.ordering ASC'); $toolbarplugins = $db->setQuery($sql)->loadObjectList(); $toolbarplugins = $this->_getSortRowToolbars($toolbarplugins); $this->assignRef('toolbarplugins', $toolbarplugins); $this->assignRef('plugins', $plugins); } // $params = new JRegistry($this->item->params); $components = $params->get('components', array()); $db->setQuery("SELECT element as value, REPLACE(element,'com_','') as text FROM #__extensions WHERE type = 'component' ORDER BY element ASC"); $allcomponents = $db->loadObjectList(); $lists['components'] = JHTML::_('select.genericlist', $allcomponents, 'components[]', ' size="10" multiple', 'value', 'text', $components); $this->assignRef('lists', $lists); $this->assignRef('toolbar', $this->item); $this->assignRef('total', $total); $this->addToolbar(); parent::display($tpl); }