예제 #1
0
 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);
 }
예제 #2
0
파일: view.php 프로젝트: enjoy2000/smcd
 function display($tpl = null)
 {
     $canDo = JCKHelper::getActions();
     $app = JFactory::getApplication();
     if (!$canDo->get('jckman.install')) {
         $app->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_INSTALL'), 'error');
         return false;
     }
     //end if
     /*
      * Set toolbar items for the page
      */
     $bar =& JToolBar::getInstance('toolbar');
     // Add a Link button for Control Panel
     $bar->appendButton('Link', 'cpanel', JText::_('COM_JCKMAN_SUBMENU_CPANEL_NAME'), 'index.php?option=com_jckman&controller=cpanel');
     JToolBarHelper::help('screen.installer');
     $paths = new stdClass();
     $paths->first = '';
     $lookup = array(JHTML::_('select.option', 0, JText::_('All')));
     $selections =& $this->get('ToolbarList');
     $lists['selections'] = JHTML::_('select.genericlist', $selections, 'selections[]', 'class="inputbox" size="15" multiple="multiple" style=width:182px;', 'value', 'text', $lookup, 'selections');
     $this->assignRef('paths', $paths);
     $this->assignRef('state', $this->get('state'));
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
예제 #3
0
 protected function addToolbar()
 {
     $bar = JToolBar::getInstance('toolbar');
     $canDo = JCKHelper::getActions();
     JToolBarHelper::title(JText::_('COM_JCKMAN_SUBMENU_PLUGIN_NAME'), 'plugin.png');
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('list.edit');
     }
     //end if
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::publishList('list.publish');
         JToolBarHelper::unpublishList('list.unpublish');
         JToolbarHelper::checkin('list.checkin');
     }
     //end if
     // Add a Link button for Control Panel
     $bar->appendButton('Link', 'cpanel', JText::_('COM_JCKMAN_SUBMENU_CPANEL_NAME'), 'index.php?option=com_jckman&view=cpanel');
     JToolBarHelper::help($this->app->input->get('view'), false, 'http://www.joomlackeditor.com/installation-guide?start=14#plugin_man_help');
     JCKHelper::addSubmenu($this->app->input->get('view'));
     JHtmlSidebar::setAction('index.php?option=com_jckman&view=list');
     // FILTERS
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JCKHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('- Select Core Type -'), 'filter_iscore', JHtml::_('select.options', array(JHtml::_('select.option', '1', 'Core Plugins'), JHtml::_('select.option', '0', 'Not Core Plugins')), 'value', 'text', $this->state->get('filter.iscore')));
     $this->sidebar = JHtmlSidebar::render();
 }
예제 #4
0
function addCustomSubMenus($controller, $type, $subMenus, $task = '', $action = 'Get')
{
    $canDo = JCKHelper::getActions();
    switch ($action) {
        case 'Post':
            JSubMenuHelper::addEntry(JText::_($controller), '#" onclick="javascript:document.adminForm.view.value=\'' . $controller . '\'; document.adminForm.task.value=\'\';Joomla.submitbutton(\'\');', !in_array($type, $subMenus));
            foreach ($subMenus as $name => $extension) {
                if ($name == 'Installer' && !$canDo->get('jckman.install')) {
                    continue;
                } elseif ($name == 'Restore Backup' && !$canDo->get('core.edit')) {
                    continue;
                } elseif ($name == 'Plugins' && !$canDo->get('jckman.uninstall')) {
                    continue;
                }
                JSubMenuHelper::addEntry(JText::_($name), '#" onclick="javascript:document.adminForm.view.value=\'' . $extension . '\';Joomla.submitbutton(\'' . $task . '\');', $extension == $type);
            }
            break;
        default:
            if ($type == '') {
                $type = $controller;
            }
            foreach ($subMenus as $name => $extension) {
                JSubMenuHelper::addEntry(JText::_($name), 'index.php?option=com_jckman&controller=' . $extension . '"', $extension == $type);
            }
    }
}
예제 #5
0
 function display($tpl = null)
 {
     $this->canDo = JCKHelper::getActions();
     $this->app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $this->icons = JCKModuleHelper::getModules('jck_icon');
     $this->modules = JCKModuleHelper::getModules('jck_cpanel');
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #6
0
 function __construct($default = array())
 {
     parent::__construct($default);
     $this->canDo = JCKHelper::getActions();
     $this->registerTask('apply', 'save');
     $this->registerTask('edit', 'display');
     $this->registerTask('add', 'display');
     $this->registerTask('trash', 'remove');
     // drop-down menu
     $this->registerTask('remove', 'remove');
 }
예제 #7
0
파일: list.php 프로젝트: scarsroga/blog-soa
 function __construct($default = array())
 {
     parent::__construct($default);
     $this->canDo = JCKHelper::getActions();
     $this->registerTask('apply', 'save');
     $this->registerTask('unpublish', 'publish');
     $this->registerTask('edit', 'display');
     $this->registerTask('add', 'display');
     $this->registerTask('orderup', 'order');
     $this->registerTask('orderdown', 'order');
 }
예제 #8
0
 protected function addToolbar()
 {
     $bar = JToolBar::getInstance('toolbar');
     $canDo = JCKHelper::getActions();
     JToolBarHelper::title(JText::_('COM_JCKMAN_SUBMENU_IMPORT_NAME'), 'plugin.png');
     if (!JCKHelper::isMobile() && !JCKHelper::isiPad()) {
         $bar->appendButton('Link', 'export', JText::_('JTOOLBAR_EXPORT'), 'index.php?option=com_jckman&task=cpanel.export');
     }
     $bar->appendButton('Link', 'cpanel', JText::_('COM_JCKMAN_SUBMENU_CPANEL_NAME'), 'index.php?option=com_jckman&view=cpanel');
     JToolBarHelper::help($this->app->input->get('view'), false, 'http://www.joomlackeditor.com/installation-guide?start=20#restore');
     JCKHelper::addSubmenu($this->app->input->get('view'));
     $this->sidebar = JHtmlSidebar::render();
 }
예제 #9
0
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JoomlaCK Editor Manager'), 'cpanel.png');
     $canDo = JCKHelper::getActions();
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_jckman');
     }
     $lang = JFactory::getLanguage();
     $pane = JPane::getInstance('sliders');
     $icons = JCKModuleHelper::getModules('jck_icon');
     $modules = JCKModuleHelper::getModules('jck_cpanel');
     $this->assignRef('icons', $icons);
     $this->assignRef('pane', $pane);
     $this->assignRef('modules', $modules);
     parent::display($tpl);
 }
예제 #10
0
 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);
 }
예제 #11
0
 public static function addSubmenu($vName = false)
 {
     $canDo = JCKHelper::getActions();
     $subMenus = array('COM_JCKMAN_SUBMENU_CPANEL_NAME' => array('extension' => 'cpanel', 'permission' => '', 'hideinmob' => false, 'hideinipad' => false), 'COM_JCKMAN_SUBMENU_PLUGIN_NAME' => array('extension' => 'list', 'permission' => '', 'hideinmob' => false, 'hideinipad' => false), 'COM_JCKMAN_SUBMENU_INSTALL_NAME' => array('extension' => 'install', 'permission' => 'jckman.install', 'hideinmob' => false, 'hideinipad' => false), 'COM_JCKMAN_SUBMENU_UNINSTALL_NAME' => array('extension' => 'extension', 'permission' => 'jckman.uninstall', 'hideinmob' => false, 'hideinipad' => false), 'COM_JCKMAN_SUBMENU_SYSTEMCHECK_NAME' => array('extension' => 'cpanel&taskbtn=system', 'permission' => 'core.edit', 'hideinmob' => true, 'hideinipad' => true), 'COM_JCKMAN_SUBMENU_LAYOUT_NAME' => array('extension' => 'toolbars', 'permission' => '', 'hideinmob' => true, 'hideinipad' => true), 'COM_JCKMAN_SUBMENU_IMPORT_NAME' => array('extension' => 'import', 'permission' => 'core.edit', 'hideinmob' => true, 'hideinipad' => true), 'COM_JCKMAN_SUBMENU_BACKUP_NAME' => array('extension' => 'cpanel&taskbtn=export', 'permission' => '', 'hideinmob' => true, 'hideinipad' => true), 'COM_JCKMAN_SUBMENU_SYNC_NAME' => array('extension' => 'cpanel&taskbtn=sync', 'permission' => 'jckman.sync', 'hideinmob' => false, 'hideinipad' => false), 'COM_JCKMAN_SUBMENU_JCKEDITOR_NAME' => array('extension' => 'cpanel&taskbtn=editor', 'permission' => '', 'hideinmob' => false, 'hideinipad' => false));
     foreach ($subMenus as $name => $params) {
         // hide in iPad
         if (!$params['hideinipad'] || $params['hideinipad'] && !self::isiPad()) {
             // hide in mobile
             if (!$params['hideinmob'] || $params['hideinmob'] && !self::isMobile()) {
                 // perform any permissions
                 if (!$params['permission'] || $canDo->get($params['permission'])) {
                     JHtmlSidebar::addEntry(JText::_($name), 'index.php?option=com_jckman&view=' . $params['extension'], $params['extension'] == $vName);
                 }
             }
         }
     }
 }
예제 #12
0
 function display($tpl = null)
 {
     $this->canDo = JCKHelper::getActions();
     $this->app = JFactory::getApplication();
     $model = JModelLegacy::getInstance('Plugin', 'JCKManModel');
     $this->items = $model->getItems();
     $this->pagination = $model->getPagination();
     $langModel = JModelLegacy::getInstance('Language', 'JCKManModel');
     $this->languages = $langModel->getItems();
     $this->langPagination = $langModel->getPagination();
     if (!$this->canDo->get('jckman.uninstall')) {
         $this->app->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_INSTALL'), 'error');
         return false;
     }
     //end if
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #13
0
 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);
 }
예제 #14
0
파일: view.php 프로젝트: enjoy2000/smcd
 function display($tpl = null)
 {
     $canDo = JCKHelper::getActions();
     $app = JFactory::getApplication();
     if (!$canDo->get('jckman.uninstall')) {
         $app->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_INSTALL'), 'error');
         return false;
     }
     //end
     /*
      * Set toolbar items for the page
      */
     $bar =& JToolBar::getInstance('toolbar');
     // Add a Link button for Control Panel
     $bar->appendButton('Link', 'cpanel', 'Control Panel', 'index.php?option=com_jckman&controller=cpanel');
     JToolBarHelper::deleteList('', 'remove', 'Uninstall');
     $lookup = array(JHTML::_('select.option', 0, JText::_('All')));
     // Get data from the model
     $items =& $this->get('Items');
     $pagination =& $this->get('Pagination');
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
예제 #15
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $canDo = JCKHelper::getActions();
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     JArrayHelper::toInteger($cid, array(0));
     if (!count($cid) && !$canDo->get('core.create')) {
         $mainframe->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_CREATE'), 'error');
         return false;
     } elseif (!$canDo->get('core.edit')) {
         $mainframe->redirect(JRoute::_('index.php?option=com_jckman&view=cpanel', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_EDIT'), 'error');
         return false;
     }
     //end if
     JToolBarHelper::title(JText::_('Layout Manager') . ': <small><small>[' . JText::_('Edit') . ']</small></small>', 'layout.png');
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancelEdit', 'Close');
     $lists = array();
     $user = JFactory::getUser();
     $row = JCKHelper::getTable('toolbar');
     // load the row from the db table
     $row->load($cid[0]);
     // fail if checked out not by 'me'
     if ($row->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The toolbar'), $row->title);
         $this->setRedirect('index.php?option=' . $option . '&controller=Toolbars', $msg, 'error');
         return false;
     }
     if ($cid[0]) {
         $row->checkout($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($row->name) == strtolower($this->default) || strtolower($row->name) == strtolower($this->defaultFT)) {
             $row->default = true;
         } else {
             $row->default = false;
         }
     } else {
         $row->params = '';
         $row->default = false;
     }
     $db = JFactory::getDBO();
     //set the default total number of plugin records
     $total = 0;
     $totalRows = 0;
     if ($cid[0]) {
         $total = 1;
         $query = 'SELECT p.id,p.name,p.title,p.icon,tp.row' . ' FROM #__jckplugins p' . ' JOIN #__jcktoolbarplugins tp ON tp.pluginid = p.id' . ' LEFT JOIN #__jckplugins parent on parent.id = p.parentid' . ' WHERE tp.state = 1' . ' AND tp.toolbarid = ' . (int) $row->id . ' AND p.published = 1' . ' AND(p.parentid IS NULL OR parent.published = 1)' . ' ORDER BY tp.toolbarid ASC,tp.row ASC,tp.ordering ASC';
         $db->setQuery($query);
         $toolbarplugins = $db->loadObjectList();
         // get the total number of core plugin records
         $query = 'SELECT COUNT(*)' . ' FROM #__jcktoolbarplugins tp' . ' JOIN #__jckplugins p ON tp.pluginid = p.id' . ' WHERE tp.toolbarid =' . (int) $row->id . ' AND p.iscore = 1';
         $db->setQuery($query);
         $totalRows = $db->loadResult();
         if (!$totalRows) {
             require_once CKEDITOR_LIBRARY . DS . 'toolbar.php';
             $CKfolder = CKEDITOR_LIBRARY . DS . 'toolbar';
             $filename = $CKfolder . DS . $row->name . '.php';
             require $filename;
             $classname = 'JCK' . ucfirst($row->name);
             $toolbar = new $classname();
             $query = 'SELECT p.id, p.title' . ' FROM #__jckplugins p' . ' LEFT JOIN #__jckplugins parent on parent.id = p.parentid' . ' AND parent.published = 1' . ' WHERE p.title != ""' . ' AND p.published = 1' . ' AND p.iscore = 1';
             $db->setQuery($query);
             $allplugins = $db->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) $row->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) $row->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()) {
                     JError::raiseWarning(500, $db->getErrorMsg());
                 }
             }
         }
         $query = 'SELECT p.id,p.name,p.title,p.icon,p.row' . ' FROM #__jckplugins p' . ' LEFT JOIN #__jcktoolbarplugins tp ON tp.pluginid = p.id' . ' AND tp.toolbarid = ' . (int) $row->id . ' LEFT JOIN #__jckplugins parent on parent.id = p.parentid' . ' WHERE tp.pluginid is null' . ' AND p.published = 1' . ' AND p.title != ""' . ' AND(p.parentid IS NULL OR parent.published = 1)' . '  ORDER by p.row ASC, p.id ASC';
         $db->setQuery($query);
         $plugins = $db->loadObjectList();
         $query = 'SELECT tp.pluginid AS id,p.name,p.title,p.icon,tp.row' . ' FROM #__jcktoolbarplugins tp' . ' LEFT JOIN #__jckplugins p ON tp.pluginid = p.id' . ' AND p.published = 1' . ' LEFT JOIN #__jckplugins parent on parent.id = p.parentid' . ' AND parent.published = 1' . ' WHERE tp.state = 1' . ' AND tp.toolbarid = ' . (int) $row->id . ' AND(p.parentid IS NULL OR parent.published = 1)' . ' ORDER BY tp.toolbarid ASC,tp.row ASC,tp.ordering ASC';
         $db->setQuery($query);
         $toolbarplugins = $db->loadObjectList();
         $toolbarplugins = $this->_getSortRowToolbars($toolbarplugins);
         $this->assignRef('toolbarplugins', $toolbarplugins);
         $this->assignRef('plugins', $plugins);
     }
     $params = new JRegistry($row->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[]', 'style="width:150px;" size="10" multiple><option value="-1">None</option', 'value', 'text', $components);
     $this->assignRef('lists', $lists);
     $this->assignRef('toolbar', $row);
     $this->assignRef('total', $total);
     parent::display($tpl);
 }
예제 #16
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $canDo = JCKHelper::getActions();
     $option = 'com_jckman';
     JToolBarHelper::title(JText::_('Layout Manager'), 'layout.png');
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editListX();
     }
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'Copy', true);
         JToolBarHelper::addNewX();
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList();
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('checkin');
     }
     $bar = JToolBar::getInstance('toolbar');
     // Add a Link button for Control Panel
     $bar->appendButton('Link', 'cpanel', 'Control Panel', 'index.php?option=com_jckman&controller=cpanel');
     JToolBarHelper::help($mainframe->input->get('view'), false, 'http://www.joomlackeditor.com/installation-guide?start=17&secondtabshow=1#layout_man');
     $client = 'admin';
     $controller = JRequest::getWord('controller');
     $db = JFactory::getDBO();
     $filter_order = $mainframe->getUserStateFromRequest("{$option}.{$controller}.{$client}.filter_order", 'filter_order', 't.id', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest("{$option}.{$controller}.{$client}.filter_order_Dir", 'filter_order_Dir', '', 'word');
     $filter_state = $mainframe->getUserStateFromRequest("{$option}.{$controller}.{$client}.filter_state", 'filter_state', '', 'word');
     $search = $mainframe->getUserStateFromRequest("{$option}.{$controller}.{$client}.search", 'search', '', 'string');
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     $where = array();
     if ($search) {
         $where[] = 'LOWER( t.name ) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     if ($filter_state) {
         if ($filter_state == 'P') {
             $where[] = 't.published = 1';
         } else {
             if ($filter_state == 'U') {
                 $where[] = 't.published = 0';
             }
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
     // get the total number of records
     $query = 'SELECT COUNT(*)' . ' FROM #__jcktoolbars AS t' . $where;
     $db->setQuery($query);
     $total = $db->loadResult();
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $query = 'SELECT t.*, u.name AS toolbar' . ' FROM #__jcktoolbars AS t' . ' LEFT JOIN #__users AS u ON u.id = t.checked_out' . $where . ' GROUP BY t.id' . $orderby;
     $db->setQuery($query, $pagination->limitstart, $pagination->limit);
     $rows = $db->loadObjectList();
     if ($db->getErrorNum()) {
         echo $db->stderr();
         return false;
     }
     // state filter
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     //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');
     $user = JFactory::getUser();
     $this->assignRef('user', $user);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $rows);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
예제 #17
0
 function __construct($default = array())
 {
     parent::__construct($default);
     $this->canDo = JCKHelper::getActions();
 }
예제 #18
0
        echo JHTML::image(JUri::root() . $path . $image, $text);
        ?>
			<div><?php 
        echo $text;
        ?>
</div>
		</a>
		<?php 
    }
    echo '<div id="jckcpanel">';
    $size = '64';
    $base = 'index.php?option=com_jckman';
    $view = '&amp;view=';
    $task = '&amp;task=';
    $path = 'administrator/components/com_jckman/icons/';
    $canDo = JCKHelper::getActions();
    $isMobile = JCKHelper::isMobile();
    $isIOS = JCKHelper::isMobile() || JCKHelper::isiPad();
    quickiconButton($base . $view . 'list', 'icon-' . $size . '-plugin.png', JText::_('COM_JCKMAN_QUICKICON_PLUGIN_NAME'), 'list', $path);
    if ($canDo->get('jckman.install')) {
        quickiconButton($base . $view . 'install', 'icon-' . $size . '-installer.png', JText::_('COM_JCKMAN_QUICKICON_INSTALL_NAME'), 'install', $path);
    }
    if ($canDo->get('jckman.uninstall')) {
        quickiconButton($base . $view . 'extension', 'icon-' . $size . '-uninstaller.png', JText::_('COM_JCKMAN_QUICKICON_UNINSTALL_NAME'), 'plugin', $path);
    }
    $jckinstallerpath = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'install' . DS;
    if ($canDo->get('core.edit')) {
        if (is_dir($jckinstallerpath)) {
            $link = JURI::root() . 'plugins/editors/jckeditor/install/index.php?task=permissions';
            quickiconButton($link, 'icon-' . $size . '-systemcheck.png', JText::_('COM_JCKMAN_QUICKICON_SYSTEMCHECK_NAME'), 'system', $path, 'modal');
        } else {
예제 #19
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $canDo = JCKHelper::getActions();
     if (!$canDo->get('core.edit')) {
         $mainframe->redirect(JRoute::_('index.php?option=com_jckman&view=list', false), JText::_('COM_JCKMAN_PLUGIN_PERM_NO_EDIT'), 'error');
         return false;
     }
     //end if
     JToolBarHelper::title(JText::_('JCK Plugin') . ': <small><small>[' . JText::_('Edit') . ']</small></small>', 'plugin.png');
     JToolBarHelper::save('save');
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancelEdit', 'Close');
     JToolBarHelper::help('screen.plugins.edit');
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     JArrayHelper::toInteger($cid, array(0));
     $lists = array();
     $user = JFactory::getUser();
     $row = JCKHelper::getTable('plugin');
     // load the row from the db table
     $row->load($cid[0]);
     // Hide CK's plugin
     if (!$row || in_array($row->name, JCKHelper::getHiddenPlugins())) {
         $mainframe->redirect('index.php?option=com_jckman&view=list', 'Could Not Load Plugin.', 'error');
         return false;
     }
     // fail if checked out not by 'me'
     if ($row->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The plugin'), $row->title ? $row->title : $row->name);
         $this->setRedirect('index.php?option=' . $option . '&controller=list', $msg, 'error');
         return false;
     }
     $xmlPath = '';
     if ($row->iscore) {
         $path = JPATH_COMPONENT . DS . 'editor' . DS . plugins;
         $xmlPath = $path . DS . $row->name . '.xml';
     } else {
         $path = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'plugins' . DS . $row->name;
         $xmlPath = $path . DS . $row->name . '.xml';
     }
     //AW
     if ($cid[0]) {
         $row->checkout($user->get('id'));
         if (JFile::exists($xmlPath)) {
             $data = JApplicationHelper::parseXMLInstallFile($xmlPath);
             $row->description = $data['description'];
         } else {
             $row->description = '';
         }
     } else {
         $row->type = 'plugin';
         $row->published = 1;
         $row->description = 'From XML install file';
         $row->icon = '';
         $row->params = '';
         $ordering = array();
     }
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     // get toolbar selections
     //get Model
     $listModel = JModel::getInstance('list', 'ListModel');
     $installModel = JModel::getInstance('install', 'InstallerModel');
     $lookup = $listModel->getSelectedToolbarList();
     $selections = $installModel->getToolbarList();
     $lists['selections'] = JHTML::_('select.genericlist', $selections, 'selections[]', 'class="inputbox" size="15" multiple="multiple" style=width:182px;', 'value', 'text', $lookup, 'selections');
     if (empty($lookup)) {
         $lookup = array(JHTML::_('select.option', '0'));
         $row->pages = 'none';
     } elseif (count($lookup) == count($selections)) {
         $row->pages = 'all';
     } else {
         $row->pages = NULL;
     }
     $lists['selections'] = JHTML::_('select.genericlist', $selections, 'selections[]', 'class="inputbox" size="15" multiple="multiple" style=width:182px;', 'value', 'text', $lookup, 'selections');
     //ACL stuff
     $groups = $listModel->getUserGroupList();
     $allowedGroups = array();
     if (is_null($row->acl)) {
         //not set so everyone can see
         $allowedGroups = $groups;
     } else {
         $allowedGroups = json_decode($row->acl);
     }
     if (empty($allowedGroups)) {
         $allowedGroups = array(JHTML::_('select.option', '0'));
         $row->groups = 'special';
     } elseif (count($allowedGroups) == count($groups)) {
         $row->groups = 'all';
     } else {
         $row->groups = NULL;
     }
     $lists['groups'] = JHTML::_('select.genericlist', $groups, 'groups[]', 'class="inputbox" size="15" multiple="multiple" style=width:182px;', 'value', 'text', $allowedGroups, 'groups');
     $params = $this->prepareForm($row);
     $this->assignRef('lists', $lists);
     $this->assignRef('plugin', $row);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
예제 #20
0
 function checkin()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $canDo = JCKHelper::getActions();
     if (!$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) {
         JError::raiseWarning(101, JText::_('Select a toolbar to 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()) {
         JError::raiseError(500, $db->getErrorMsg());
     }
     $this->event_args = array('cid' => $cid, 'value' => true);
     $plural = count($cid) > 1 ? '(s)' : '';
     $msg = (int) count($cid) . chr(32) . 'plugin' . $toolbar . ' checked in';
     $this->setRedirect(JRoute::_('index.php?option=com_jckman&view=' . $app->input->get('view', 'toolbars'), false), $msg);
 }
예제 #21
0
 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);
 }
예제 #22
0
 function __construct(&$subject)
 {
     parent::__construct($subject);
     $this->canDo = JCKHelper::getActions();
     $this->app = JFactory::getApplication();
 }