Files
@ 0260ba63d9cf
Branch filter:
Location: hot67beta/administrator/components/com_content/helper.php - annotation
0260ba63d9cf
3.4 KiB
text/x-php
morepad
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 | <?php
/**
* @version $Id: helper.php 11299 2008-11-22 01:40:44Z ian $
* @package Joomla
* @subpackage Content
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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. See COPYRIGHT.php for copyright notices and
* details.
*/
/**
* Content Component Helper
*
* @static
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class ContentHelper
{
function saveContentPrep( &$row )
{
// Get submitted text from the request variables
$text = JRequest::getVar( 'text', '', 'post', 'string', JREQUEST_ALLOWRAW );
// Clean text for xhtml transitional compliance
$text = str_replace( '<br>', '<br />', $text );
// Search for the {readmore} tag and split the text up accordingly.
$pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
$tagPos = preg_match($pattern, $text);
if ( $tagPos == 0 )
{
$row->introtext = $text;
} else
{
list($row->introtext, $row->fulltext) = preg_split($pattern, $text, 2);
}
// Filter settings
jimport( 'joomla.application.component.helper' );
$config = JComponentHelper::getParams( 'com_content' );
$user = &JFactory::getUser();
$gid = $user->get( 'gid' );
$filterGroups = $config->get( 'filter_groups' );
if (is_array($filterGroups) && in_array( $gid, $filterGroups ))
{
$filterType = $config->get( 'filter_type' );
$filterTags = preg_split( '#[,\s]+#', trim( $config->get( 'filter_tags' ) ) );
$filterAttrs = preg_split( '#[,\s]+#', trim( $config->get( 'filter_attritbutes' ) ) );
switch ($filterType)
{
case 'NH':
$filter = new JFilterInput();
break;
case 'WL':
$filter = new JFilterInput( $filterTags, $filterAttrs, 0, 0, 0); // turn off xss auto clean
break;
case 'BL':
default:
$filter = new JFilterInput( $filterTags, $filterAttrs, 1, 1 );
break;
}
$row->introtext = $filter->clean( $row->introtext );
$row->fulltext = $filter->clean( $row->fulltext );
} elseif(empty($filterGroups) && $gid != '25') { // no default filtering for super admin (gid=25)
$filter = new JFilterInput( array(), array(), 1, 1 );
$row->introtext = $filter->clean( $row->introtext );
$row->fulltext = $filter->clean( $row->fulltext );
}
return true;
}
/**
* Function to reset Hit count of an article
*
*/
function resetHits($redirect, $id)
{
global $mainframe;
// Initialize variables
$db = & JFactory::getDBO();
// Instantiate and load an article table
$row = & JTable::getInstance('content');
$row->Load($id);
$row->hits = 0;
$row->store();
$row->checkin();
$msg = JText::_('Successfully Reset Hit count');
$mainframe->redirect('index.php?option=com_content§ionid='.$redirect.'&task=edit&id='.$id, $msg);
}
function filterCategory($query, $active = NULL)
{
// Initialize variables
$db = & JFactory::getDBO();
$categories[] = JHTML::_('select.option', '0', '- '.JText::_('Select Category').' -');
$db->setQuery($query);
$categories = array_merge($categories, $db->loadObjectList());
$category = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $active);
return $category;
}
}
|