Ejemplo n.º 1
0
 public function &getAggregators()
 {
     static $aggregators;
     if (!isset($aggregators)) {
         $aggregators = array();
     }
     // get the aggregator format for this instance
     $format = $this->get('format');
     if (empty($aggregators[$format])) {
         jimport('joomla.filesystem.folder');
         // get a plugin instance
         $plugin = WFEditorPlugin::getInstance();
         $aggregators[$format] = array();
         $path = WF_EDITOR_EXTENSIONS . '/aggregator';
         $files = JFolder::files($path, '\\.php$', false, true);
         foreach ($files as $file) {
             require_once $file;
             $name = basename($file, '.php');
             $classname = 'WFAggregatorExtension_' . ucfirst($name);
             // only load if enabled
             if (class_exists($classname)) {
                 $aggregator = new $classname();
                 // check if enabled
                 if ($aggregator->isEnabled()) {
                     if ($aggregator->get('format') == $format) {
                         $aggregator->set('name', $name);
                         $aggregator->set('title', 'WF_AGGREGATOR_' . strtoupper($name) . '_TITLE');
                         $aggregators[$format][] = $aggregator;
                     }
                 }
             }
         }
     }
     return $aggregators[$format];
 }
Ejemplo n.º 2
0
 function getList()
 {
     $wf =& WFEditorPlugin::getInstance();
     if ($wf->checkAccess('menu', '1')) {
         return '<li id="index.php?option=com_menu"><div class="tree-row"><div class="tree-image"></div><span class="folder menu nolink"><a href="javascript:;">' . JText::_('MENU') . '</a></span></div></li>';
     }
 }
Ejemplo n.º 3
0
 /**
  * Return the full user directory path. Create if required
  *
  * @param string	The base path
  * @access public
  * @return Full path to folder
  */
 function getRootDir()
 {
     static $root;
     if (!isset($root)) {
         $root = parent::getRootDir();
         $wf = WFEditorPlugin::getInstance();
         // Restricted Joomla! folders
         $restricted = explode(',', $wf->getParam('editor.filesystem.joomla.restrict_dir', 'administrator,cache,components,includes,language,libraries,logs,media,modules,plugins,templates,xmlrpc'));
         $allowroot = $wf->getParam('editor.filesystem.joomla.allow_root', 0);
         // Revert to default if empty
         if (empty($root) && !$allowroot) {
             $root = 'images';
         }
         // Force default if directory is a joomla directory
         $parts = explode('/', $root);
         if (in_array(strtolower($parts[0]), $restricted) && !$allowroot) {
             $root = 'images';
         }
         if (!empty($root)) {
             // Create the folder
             $full = WFUtility::makePath(JPATH_SITE, $root);
             if (!JFolder::exists($full)) {
                 $this->folderCreate($full);
             }
             // Fallback
             $root = JFolder::exists($full) ? $root : 'images';
         }
     }
     return $root;
 }
Ejemplo n.º 4
0
 function getList()
 {
     $wf = WFEditorPlugin::getInstance();
     if ($wf->checkAccess('links.joomlalinks.menu', 1)) {
         return '<li id="index.php?option=com_menu"><div class="tree-row"><div class="tree-image"></div><span class="folder menu nolink"><a href="javascript:;">' . WFText::_('WF_LINKS_JOOMLALINKS_MENU') . '</a></span></div></li>';
     }
 }
Ejemplo n.º 5
0
 function isEnabled()
 {
     $wf = WFEditorPlugin::getInstance();
     if (JPluginHelper::isEnabled('system', 'rokbox') && $wf->getParam('popups.rokbox.enable', 1) == 1) {
         return true;
     }
     return false;
 }
Ejemplo n.º 6
0
 function isEnabled()
 {
     $plugin = WFEditorPlugin::getInstance();
     if ($plugin->getParam('popups.window.enable', 1) && ($plugin->getName() == 'link' || $plugin->getName() == 'imgmanager_ext')) {
         return true;
     }
     return false;
 }
Ejemplo n.º 7
0
 public function isEnabled()
 {
     $wf = WFEditorPlugin::getInstance();
     if (JPluginHelper::isEnabled('system', 'widgetkit_system') && $wf->getParam('popups.widgetkit.enable', 1) == 1) {
         return true;
     }
     return false;
 }
Ejemplo n.º 8
0
 public function isEnabled()
 {
     $jce = WFEditorPlugin::getInstance();
     if (JPluginHelper::isEnabled('system', 'jcemediabox') && $jce->getParam('popups.jcemediabox.enable', 1) == 1) {
         return true;
     }
     return false;
 }
Ejemplo n.º 9
0
 public function getList()
 {
     //Reference to JConentEditor (JCE) instance
     $wf = WFEditorPlugin::getInstance();
     if ($wf->checkAccess('links.joomlalinks.contacts', 1)) {
         return '<li id="index.php?option=com_contact"><div class="tree-row"><div class="tree-image"></div><span class="folder contact nolink"><a href="javascript:;">' . WFText::_('WF_LINKS_JOOMLALINKS_CONTACTS') . '</a></span></div></li>';
     }
 }
Ejemplo n.º 10
0
 public function getList()
 {
     $advlink = WFEditorPlugin::getInstance();
     $list = '';
     if ($advlink->checkAccess('flexicontentlinks.items', '1')) {
         return '<li id="index.php?option=com_flexicontent_items&view=category&cid=1"><div class="tree-row"><div class="tree-image"></div><span class="folderflexicontent nolink"><a href="javascript:;">' . JText::_('FLEXIcontent') . '</a></span></div></li>';
     }
     return $list;
 }
Ejemplo n.º 11
0
 public function getList()
 {
     $advlink = WFEditorPlugin::getInstance();
     $list = '';
     if ($advlink->checkAccess('JEventslinks.JEvents', '1')) {
         $list = '<li id="index.php?option=com_jevents"><div class="tree-row"><div class="tree-image"></div><span class="folder content nolink"><a href="javascript:;">' . JText::_('JEvents Content') . '</a></span></div></li>';
     }
     return $list;
 }
Ejemplo n.º 12
0
 /**
  * Return the full user directory path. Create if required
  *
  * @param string  The base path
  * @access public
  * @return Full path to folder
  */
 function getRootDir()
 {
     static $root;
     if (!isset($root)) {
         $user = JFactory::getUser();
         $wf = WFEditorPlugin::getInstance();
         $profile = $wf->getProfile();
         // Get base directory as shared parameter
         $root = $this->get('dir', '');
         // Remove whitespace
         $root = trim($root);
         if (!empty($root)) {
             // Convert slashes / Strip double slashes
             $root = preg_replace('/[\\\\]+/', '/', $root);
             // Remove first leading slash
             $root = ltrim($root, '/');
             // Force default directory if base param starts with a variable or a . eg $id
             if (preg_match('/[\\.\\$]/', $root[0])) {
                 $root = 'images';
             }
             jimport('joomla.user.helper');
             // Joomla! 1.6+
             if (method_exists('JUserHelper', 'getUserGroups')) {
                 $groups = JUserHelper::getUserGroups($user->id);
                 // get the first group
                 $group_id = array_shift(array_keys($groups));
                 // Joomla! 2.5?
                 if (is_int($group_id)) {
                     // usergroup table
                     $group = JTable::getInstance('Usergroup', 'JTable');
                     $group->load($group_id);
                     // usertype
                     $usertype = $group->title;
                 } else {
                     $usertype = $group_id;
                 }
             } else {
                 $usertype = $user->usertype;
             }
             // Replace any path variables
             $pattern = array('/\\$id/', '/\\$username/', '/\\$usertype/', '/\\$(group|profile)/', '/\\$day/', '/\\$month/', '/\\$year/');
             $replace = array($user->id, $user->username, $usertype, $profile->name, date('d'), date('m'), date('Y'));
             $root = preg_replace($pattern, $replace, $root);
             // split into path parts to preserve /
             $parts = explode('/', $root);
             // clean path parts
             $parts = WFUtility::makeSafe($parts, $wf->getParam('editor.websafe_mode', 'utf-8'), $wf->getParam('editor.websafe_allow_spaces', 0));
             //join path parts
             $root = implode('/', $parts);
         }
     }
     return $root;
 }
Ejemplo n.º 13
0
 public function getLinks($args)
 {
     $wf = WFEditorPlugin::getInstance();
     $items = array();
     switch ($args->view) {
         // Get all WebLink categories
         default:
         case 'categories':
             $categories = WFLinkBrowser::getCategory('com_weblinks');
             foreach ($categories as $category) {
                 $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                 $items[] = array('id' => 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
             }
             break;
             // Get all links in the category
         // Get all links in the category
         case 'category':
             require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
             require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
             if (!WF_JOOMLA15) {
                 $categories = WFLinkBrowser::getCategory('com_weblinks', $args->id);
                 if (count($categories)) {
                     foreach ($categories as $category) {
                         $children = WFLinkBrowser::getCategory('com_weblinks', $category->id);
                         if ($children) {
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                         } else {
                             $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->slug));
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->slug . $itemid;
                         }
                         $items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
                     }
                 }
             }
             $weblinks = self::_weblinks($args->id);
             foreach ($weblinks as $weblink) {
                 $items[] = array('id' => WeblinksHelperRoute::getWeblinkRoute($weblink->id, $args->id), 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
Ejemplo n.º 14
0
 function getLinks($args)
 {
     global $_DOCMAN, $mainframe;
     $wf = WFEditorPlugin::getInstance();
     jimport('joomla.filesystem.file');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'docman.class.php';
     //DOCMan core interaction API
     $_DOCMAN = new dmMainFrame(_DM_TYPE_DOCLINK);
     // Load classes and language
     require_once $_DOCMAN->getPath('classes', 'utils');
     $cid = isset($args->gid) ? $args->gid : 0;
     //get folders
     $categories = DOCMAN_Cats::getChildsByUserAccess($cid);
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     switch ($view) {
         default:
             foreach ($categories as $category) {
                 $items[] = array('id' => 'index.php?option=com_docman&view=category&gid=' . $category->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $category->name, 'class' => 'folder docmanlinks');
             }
             break;
         case 'category':
             //get items
             if ($cid) {
                 $categories = DOCMAN_Cats::getChildsByUserAccess($cid);
                 $documents = DOCMAN_Docs::getDocsByUserAccess($cid, 'name', 'ASC', 999, 0);
             } else {
                 $categories = array();
                 $documents = array();
             }
             foreach ($categories as $category) {
                 $items[] = array('id' => 'index.php?option=com_docman&view=category&gid=' . $category->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $category->name, 'class' => 'folder docmanlinks');
             }
             foreach ($documents as $document) {
                 $items[] = array('id' => 'index.php?option=com_docman&task=doc_' . $wf->getParam('docmanlinks_link', 'download') . '&gid=' . $document->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $document->dmname, 'class' => 'file docmanlinks ' . JFile::getExt($document->dmfilename));
             }
             break;
     }
     return $items;
 }
Ejemplo n.º 15
0
 /**
  * Return the full user directory path. Create if required
  *
  * @param string  The base path
  * @access public
  * @return Full path to folder
  */
 function getRootDir()
 {
     static $root;
     if (!$root) {
         $user = JFactory::getUser();
         $wf = WFEditorPlugin::getInstance();
         $profile = $wf->getProfile();
         // Get base directory as shared parameter
         $root = $this->get('dir', 'images');
         // Remove whitespace
         $root = trim($root);
         // Convert slashes / Strip double slashes
         $root = preg_replace('/[\\\\]+/', '/', $root);
         // Remove first leading slash
         $root = ltrim($root, '/');
         // Force default directory if base param starts with a variable or a . eg $id
         if (preg_match('/[\\.\\$]/', $root[0])) {
             $root = 'images';
         }
         jimport('joomla.user.helper');
         // Joomla! 1.6+
         if (method_exists('JUserHelper', 'getUserGroups')) {
             $groups = JUserHelper::getUserGroups($user->id);
             $usertype = array_shift(array_keys($groups));
         } else {
             $usertype = $user->usertype;
         }
         // Replace any path variables
         $pattern = array('/\\$id/', '/\\$username/', '/\\$usertype/', '/\\$(group|profile)/', '/\\$day/', '/\\$month/', '/\\$year/');
         $replace = array($user->id, strtolower($user->username), strtolower($usertype), strtolower($profile->name), date('d'), date('m'), date('Y'));
         $root = preg_replace($pattern, $replace, $root);
         // Clean
         $root = preg_replace(array('/$\\w+\\b/', '/(\\.) {2,}/', '/[^A-Za-z0-9:\\.\\_\\-\\/]/'), '', $root);
     }
     return $root;
 }
Ejemplo n.º 16
0
 public function isEnabled()
 {
     $wf = WFEditorPlugin::getInstance();
     return $wf->checkAccess($wf->getName() . '.links.joomlalinks.enable', 1);
 }
Ejemplo n.º 17
0
 private static function route($url)
 {
     $wf = WFEditorPlugin::getInstance();
     if ($wf->getParam('links.joomlalinks.sef_url', 0)) {
         $url = WFLinkExtension::route($url);
     }
     return $url;
 }
Ejemplo n.º 18
0
<?php

/**
 * @package   	JCE
 * @copyright 	Copyright (c) 2009-2015 Ryan Demmer. All rights reserved.
 * @license   	GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * JCE is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */
defined('_JEXEC') or die('RESTRICTED');
$plugin = WFEditorPlugin::getInstance();
?>
<table>
    <tr>
        <td style="vertical-align:top;width:75%;">
            <fieldset>
                <legend><?php 
echo WFText::_('WF_LABEL_PROPERTIES');
?>
</legend>
                <table summary="image" width="100%">
                    <tr>
                        <td><label for="src" class="hastip" title="<?php 
echo WFText::_('WF_LABEL_URL_DESC');
?>
"><?php 
echo WFText::_('WF_LABEL_URL');
?>
</label></td>
Ejemplo n.º 19
0
 function getParams()
 {
     $plugin = WFEditorPlugin::getInstance();
     return array('extensions' => $plugin->getParam('jceplayer.extensions', 'flv,f4v,mp3,mp4'), 'dimensions' => array('audio' => array('width' => 300, 'height' => 35)), 'path' => $plugin->getParam('jceplayer.path', 'media/jce/mediaplayer/mediaplayer.swf'));
 }
Ejemplo n.º 20
0
 /**
  * Return a parameter for the current plugin / group
  * @param 	object $param Parameter name
  * @param 	object $default Default value
  * @return 	string Parameter value
  */
 public function getParam($param, $default = '')
 {
     $wf = WFEditorPlugin::getInstance();
     return $wf->getParam($param, $default);
 }
Ejemplo n.º 21
0
 function getParams()
 {
     $plugin = WFEditorPlugin::getInstance();
     return array('width' => $plugin->getParam('aggregator.vimeo.width', 400), 'height' => $plugin->getParam('aggregator.vimeo.height', 225));
 }
Ejemplo n.º 22
0
 public function getFileSystem()
 {
     static $filesystem;
     if (!is_object($filesystem)) {
         $wf = WFEditorPlugin::getInstance();
         $config = array('dir' => $this->get('dir'), 'upload_conflict' => $wf->getParam('editor.upload_conflict', 'overwrite'), 'filetypes' => $this->getFileTypes('array'));
         $filesystem = WFFileSystem::getInstance($this->get('filesystem'), $config);
     }
     return $filesystem;
 }
Ejemplo n.º 23
0
 function _weblinks($id)
 {
     $wf = WFEditorPlugin::getInstance();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $dbquery = $db->getQuery(true);
     $section = JText::_('Web Links');
     $query = 'SELECT a.id AS slug, b.id AS catslug, a.title AS title, a.description AS text, a.url, a.alias';
     if ($wf->getParam('links.joomlalinks.weblinks_alias', 1) == 1) {
         if (is_object($dbquery)) {
             //sqlsrv changes
             $case_when1 = ' CASE WHEN ';
             $case_when1 .= $dbquery->charLength('a.alias');
             $case_when1 .= ' THEN ';
             $a_id = $dbquery->castAsChar('a.id');
             $case_when1 .= $dbquery->concatenate(array($a_id, 'a.alias'), ':');
             $case_when1 .= ' ELSE ';
             $case_when1 .= $a_id . ' END as slug';
             $case_when2 = ' CASE WHEN ';
             $case_when2 .= $dbquery->charLength('b.alias');
             $case_when2 .= ' THEN ';
             $c_id = $dbquery->castAsChar('b.id');
             $case_when2 .= $dbquery->concatenate(array($c_id, 'b.alias'), ':');
             $case_when2 .= ' ELSE ';
             $case_when2 .= $c_id . ' END as catslug';
         } else {
             $case_when1 = ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug';
             $case_when2 = ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug';
         }
         $query .= ',' . $case_when1 . ',' . $case_when2;
     }
     if (method_exists('JUser', 'getAuthorisedViewLevels')) {
         $where = ' AND a.state = 1';
         $where .= ' AND b.access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
     } else {
         $where = ' AND a.published = 1';
         $where .= ' AND b.access <= ' . (int) $user->get('aid');
     }
     $query .= ' FROM #__weblinks AS a' . ' INNER JOIN #__categories AS b ON b.id = ' . (int) $id . ' WHERE a.catid = ' . (int) $id . $where . ' AND b.published = 1' . ' ORDER BY a.title';
     $db->setQuery($query, 0);
     return $db->loadObjectList();
 }
Ejemplo n.º 24
0
 /**
  * Category function used by many extensions
  *
  * @access	public
  * @return	Category list object.
  * @since	1.5
  */
 public function getCategory($section, $parent = 1)
 {
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $wf = WFEditorPlugin::getInstance();
     $query = $db->getQuery(true);
     $where = array();
     $version = new JVersion();
     $language = $version->isCompatible('3.0') ? ', language' : '';
     if (method_exists('JUser', 'getAuthorisedViewLevels')) {
         $where[] = 'parent_id = ' . (int) $parent;
         $where[] = 'extension = ' . $db->Quote($section);
         $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
         if (!$wf->checkAccess('static', 1)) {
             $where[] = 'path != ' . $db->Quote('uncategorised');
         }
     } else {
         $where[] = 'section = ' . $db->Quote($section);
         $where[] = 'access <= ' . (int) $user->get('aid');
     }
     if ($wf->getParam('category_alias', 1) == 1) {
         if (is_object($query)) {
             //sqlsrv changes
             $case = ', CASE WHEN ';
             $case .= $query->charLength('alias', '!=', '0');
             $case .= ' THEN ';
             $a_id = $query->castAsChar('id');
             $case .= $query->concatenate(array($a_id, 'alias'), ':');
             $case .= ' ELSE ';
             $case .= $a_id . ' END as slug';
         } else {
             $case .= ', CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(":", id, alias) ELSE id END as slug';
         }
     }
     if (is_object($query)) {
         $where[] = 'published = 1';
         $query->select('id AS slug, id AS id, title, alias, access' . $language . $case)->from('#__categories')->where($where)->order('title');
     } else {
         $query = 'SELECT id AS slug, id AS id, title, alias, access' . $case;
         $query .= ' FROM #__categories';
         $query .= ' WHERE ' . implode(' AND ', $where);
         $query .= ' ORDER BY title';
     }
     $db->setQuery($query);
     return $db->loadObjectList();
 }
Ejemplo n.º 25
0
 function getParams()
 {
     $plugin = WFEditorPlugin::getInstance();
     return array('width' => $plugin->getParam('aggregator.youtube.width', 425), 'height' => $plugin->getParam('aggregator.youtube.height', 350));
 }
Ejemplo n.º 26
0
 public function getPopupTemplates()
 {
     $output = '';
     $path = WF_EDITOR_EXTENSIONS . '/popups';
     $file = 'default.php';
     foreach ($this->getTemplates() as $template) {
         $wf = WFEditorPlugin::getInstance();
         $view = $wf->getView();
         $output .= $view->loadTemplate($template);
     }
     foreach ($this->getPopups() as $popup) {
         $view = new WFView(array('name' => $popup, 'base_path' => WF_EDITOR_EXTENSIONS . '/popups/' . $popup, 'template_path' => WF_EDITOR_EXTENSIONS . '/popups/' . $popup . '/tmpl'));
         $instance = $this->getPopupExtension($popup);
         $view->assign('popup', $instance);
         if (file_exists($path . '/' . $popup . '/tmpl/' . $file)) {
             ob_start();
             $output .= '<div id="popup_extension_' . $popup . '" style="display:none;">';
             $view->display();
             $output .= ob_get_contents();
             $output .= '</div>';
             ob_end_clean();
         }
     }
     return $output;
 }
Ejemplo n.º 27
0
 function getParams()
 {
     $plugin = WFEditorPlugin::getInstance();
     return array('width' => $plugin->getParam('aggregator.dailymotion.width', 480), 'height' => $plugin->getParam('aggregator.dailymotion.height', 270));
 }
Ejemplo n.º 28
0
Archivo: link.php Proyecto: 01J/topm
 /**
  * Process search
  * @param type $query Search query
  * @return array Rerach Results 
  * 
  * This method uses portions of SearchController::search from components/com_search/controller.php
  * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  */
 public function doSearch($query)
 {
     $wf = WFEditorPlugin::getInstance();
     $filter = JFilterInput::getInstance();
     if (!class_exists('JSite')) {
         // Load JSite class
         JLoader::register('JSite', JPATH_SITE . '/includes/application.php');
     }
     $app = JApplication::getInstance('site');
     $router = $app->getRouter('site');
     // get SearchHelper
     require_once JPATH_ADMINISTRATOR . '/components/com_search/helpers/search.php';
     // get router mode
     $sef = (int) $wf->getParam('search.link.sef_url', 0);
     // set router off so a raw url is returned by the Search plugin
     if ($router) {
         $router->setMode(0);
     }
     // slashes cause errors, <> get stripped anyway later on. # causes problems.
     $searchword = trim(str_replace(array('#', '>', '<', '\\'), '', $filter->clean($query)));
     $ordering = JRequest::getWord('ordering', null, 'post');
     $searchphrase = JRequest::getWord('searchphrase', 'all', 'post');
     $areas = JRequest::getVar('areas', null, 'post', 'array');
     // if searchword enclosed in double quotes, strip quotes and do exact match
     if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"') {
         $searchword = substr($searchword, 1, -1);
         $searchphrase = 'exact';
     }
     // clean areas
     if (!empty($areas)) {
         foreach ($areas as $area) {
             $areas[] = $filter->clean($area, 'cmd');
         }
     }
     $event = WF_JOOMLA15 ? 'onSearch' : 'onContentSearch';
     // trigger search on loaded plugins
     $searches = $app->triggerEvent($event, array($searchword, $searchphrase, $ordering, $areas));
     $results = array();
     $rows = array();
     foreach ($searches as $search) {
         $rows = array_merge((array) $rows, (array) $search);
     }
     for ($i = 0, $count = count($rows); $i < $count; $i++) {
         $row =& $rows[$i];
         $result = new StdClass();
         if ($searchphrase == 'exact') {
             $searchwords = array($searchword);
             $needle = $searchword;
         } else {
             $searchworda = preg_replace('#\\xE3\\x80\\x80#s', ' ', $searchword);
             $searchwords = preg_split("/\\s+/u", $searchworda);
             $needle = $searchwords[0];
         }
         // get anchors
         $anchors = self::getAnchors($row->text);
         if (!empty($anchors)) {
             $row->anchors = $anchors;
         }
         if (method_exists('SearchHelper', 'getActions')) {
             $row->text = SearchHelper::prepareSearchContent($row->text, $needle);
         } else {
             $row->text = SearchHelper::prepareSearchContent($row->text, 200, $needle);
         }
         $searchwords = array_unique($searchwords);
         $searchRegex = '#(';
         $x = 0;
         foreach ($searchwords as $k => $hlword) {
             $searchRegex .= $x == 0 ? '' : '|';
             $searchRegex .= preg_quote($hlword, '#');
             $x++;
         }
         $searchRegex .= ')#iu';
         $row->text = preg_replace($searchRegex, '<span class="highlight">\\0</span>', $row->text);
         // remove base url
         if (strpos($row->href, JURI::base(true)) !== false) {
             $row->href = substr_replace($row->href, '', 0, strlen(JURI::base(true)) + 1);
         }
         // convert to SEF
         if ($router && $sef) {
             $router->setMode(1);
             $url = str_replace('&amp;', '&', $row->href);
             $uri = $router->build($url);
             $url = $uri->toString();
             $row->href = str_replace('/administrator/', '/', $url);
         }
         $result->title = $row->title;
         $result->text = $row->text;
         $result->link = $row->href;
         $results[] = $result;
     }
     return $results;
 }
Ejemplo n.º 29
0
 /**
  * Category function used by many extensions
  *
  * @access	public
  * @return	Category list object.
  * @since	1.5
  */
 function getCategory($section, $parent = 1)
 {
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $wf =& WFEditorPlugin::getInstance();
     $query = 'SELECT id AS slug, id AS id, title, alias';
     if ($wf->getSharedParam('category_alias', 1) == 1) {
         $query .= ', CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(":", id, alias) ELSE id END as slug';
     }
     // Joomla! 1.5 section / category
     if (JOOMLA15) {
         $where = ' WHERE section = ' . $db->Quote($section);
         $where .= ' AND access <= ' . (int) $user->get('aid');
     } else {
         $where = ' WHERE parent_id = ' . (int) $parent;
         $where .= ' AND extension = ' . $db->Quote($section);
         $where .= ' AND access IN (' . implode(',', $user->authorisedLevels()) . ')';
         if (!$wf->checkAccess('static', 1)) {
             $where .= ' AND path != ' . $db->Quote('uncategorised');
         }
     }
     $query .= ' FROM #__categories' . $where . ' AND published = 1' . ' ORDER BY title';
     $db->setQuery($query);
     return $db->loadObjectList();
 }
Ejemplo n.º 30
0
    private function _getArticles($id) {
        $db = JFactory::getDBO();
        $user = JFactory::getUser();
        $wf = WFEditorPlugin::getInstance();

        $query = $db->getQuery(true);

        $case = '';

        if ($wf->getParam('links.joomlalinks.article_alias', 1) == 1) {
            if (is_object($query)) {
                //sqlsrv changes
                $case_when1 = ' CASE WHEN ';
                $case_when1 .= $query->charLength('a.alias', '!=', '0');
                $case_when1 .= ' THEN ';
                $a_id = $query->castAsChar('a.id');
                $case_when1 .= $query->concatenate(array($a_id, 'a.alias'), ':');
                $case_when1 .= ' ELSE ';
                $case_when1 .= $a_id . ' END as slug';

                $case_when2 = ' CASE WHEN ';
                $case_when2 .= $query->charLength('b.alias', '!=', '0');
                $case_when2 .= ' THEN ';
                $c_id = $query->castAsChar('b.id');
                $case_when2 .= $query->concatenate(array($c_id, 'b.alias'), ':');
                $case_when2 .= ' ELSE ';
                $case_when2 .= $c_id . ' END as catslug';
            } else {
                $case_when1 = ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug';
                $case_when2 = ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(":", b.id, b.alias) ELSE b.id END as catslug';
            }

            $case = ',' . $case_when1 . ',' . $case_when2;
        }

        if (is_object($query)) {
            $groups = implode(',', $user->getAuthorisedViewLevels());

            $query->select('a.id AS slug, b.id AS catslug, a.alias, a.title AS title, a.access, ' . $query->concatenate(array('a.introtext', 'a.fulltext')) . ' AS content' . $case);
            $query->from('#__content AS a');
            $query->innerJoin('#__categories AS b ON b.id = ' . (int) $id);
            $query->where('a.catid = ' . (int) $id);
            $query->where('a.access IN (' . $groups . ')');
            $query->where('b.access IN (' . $groups . ')');
            $query->where('a.state = 1');
            $query->order('a.title');
        } else {
            $query = 'SELECT a.id AS slug, b.id AS catslug, a.alias, a.title AS title, u.id AS sectionid, a.access, a.introtext, a.fulltext' . $case
                    . ' FROM #__content AS a'
                    . ' INNER JOIN #__categories AS b ON b.id = ' . (int) $id
                    . ' INNER JOIN #__sections AS u ON u.id = a.sectionid'
                    . ' WHERE a.catid = ' . (int) $id
                    . ' AND a.state = 1'
                    . ' AND a.access <= ' . (int) $user->get('aid')
                    . ' ORDER BY a.title';
        }

        $db->setQuery($query, 0);
        return $db->loadObjectList();
    }