150 ) {
$mosmsg = substr( $mosmsg, 0, 150 );
}
// mosmsg outputed within html
if ($mosmsg && !$popMessages && $browserCheck && $sessionCheck) {
echo "\n$mosmsg ";
}
echo $GLOBALS['_MOS_OPTION']['buffer'];
// mosmsg outputed in JS Popup
if ($mosmsg && $popMessages && $browserCheck && $sessionCheck) {
echo "\n";
}
}
/**
* Utility functions and classes
*/
function mosLoadComponent( $name ) {
// set up some global variables for use by frontend components
global $mainframe, $database, $my, $acl;
global $task, $Itemid, $id, $option, $gid;
include( $mainframe->getCfg( 'absolute_path' )."/components/com_$name/$name.php" );
}
/**
* Cache some modules information
* @return array
*/
function &initModules() {
global $database, $my, $Itemid;
if (!isset( $GLOBALS['_MOS_MODULES'] )) {
$Itemid = intval($Itemid);
$check_Itemid = '';
if ($Itemid) {
$check_Itemid = "OR mm.menuid = " . (int) $Itemid;
}
$query = "SELECT id, title, module, position, content, showtitle, params"
. "\n FROM #__modules AS m"
. "\n INNER JOIN #__modules_menu AS mm ON mm.moduleid = m.id"
. "\n WHERE m.published = 1"
. "\n AND m.access <= ". (int) $my->gid
. "\n AND m.client_id != 1"
. "\n AND ( mm.menuid = 0 $check_Itemid )"
. "\n ORDER BY ordering";
$database->setQuery( $query );
$modules = $database->loadObjectList();
foreach ($modules as $module) {
$GLOBALS['_MOS_MODULES'][$module->position][] = $module;
}
}
return $GLOBALS['_MOS_MODULES'];
}
/**
* @param string THe template position
*/
function mosCountModules( $position='left' ) {
global $database, $my, $Itemid;
$tp = intval( mosGetParam( $_GET, 'tp', 0 ) );
if ($tp) {
return 1;
}
$modules =& initModules();
if (isset( $GLOBALS['_MOS_MODULES'][$position] )) {
return count( $GLOBALS['_MOS_MODULES'][$position] );
} else {
return 0;
}
}
/**
* @param string The position
* @param int The style. 0=normal, 1=horiz, -1=no wrapper
*/
function mosLoadModules( $position='left', $style=0 ) {
global $mosConfig_gzip, $mosConfig_absolute_path, $database, $my, $Itemid, $mosConfig_caching;
$tp = intval( mosGetParam( $_GET, 'tp', 0 ) );
if ($tp) {
echo '';
echo $position;
echo ' ';
return;
}
$style = intval( $style );
$cache =& mosCache::getCache( 'com_content' );
require_once( $mosConfig_absolute_path . '/includes/frontend.html.php' );
$allModules =& initModules();
if (isset( $GLOBALS['_MOS_MODULES'][$position] )) {
$modules = $GLOBALS['_MOS_MODULES'][$position];
} else {
$modules = array();
}
if (count( $modules ) < 1) {
$style = 0;
}
if ($style == 1) {
echo " \n";
echo "\n";
}
$prepend = ($style == 1) ? "\n" : '';
$postpend = ($style == 1) ? " | \n" : '';
$count = 1;
foreach ($modules as $module) {
$params = new mosParameters( $module->params );
echo $prepend;
if ((substr("$module->module",0,4))=='mod_') {
// normal modules
if ($params->get('cache') == 1 && $mosConfig_caching == 1) {
// module caching
$cache->call('modules_html::module2', $module, $params, $Itemid, $style, $my->gid );
} else {
modules_html::module2( $module, $params, $Itemid, $style, $count );
}
} else {
// custom or new modules
if ($params->get('cache') == 1 && $mosConfig_caching == 1) {
// module caching
$cache->call('modules_html::module', $module, $params, $Itemid, $style, 0, $my->gid );
} else {
modules_html::module( $module, $params, $Itemid, $style );
}
}
echo $postpend;
$count++;
}
if ($style == 1) {
echo " \n \n";
}
}
/**
* Assembles head tags
*/
function mosShowHead() {
global $database, $option, $my, $mainframe, $_VERSION, $task, $id;
global $mosConfig_MetaDesc, $mosConfig_MetaKeys, $mosConfig_live_site, $mosConfig_sef, $mosConfig_absolute_path, $mosConfig_sitename, $mosConfig_favicon;
$mainframe->appendMetaTag( 'description', $mosConfig_MetaDesc );
$mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeys );
$mainframe->addMetaTag( 'Generator', $_VERSION->PRODUCT . ' - ' . $_VERSION->COPYRIGHT);
$mainframe->addMetaTag( 'robots', 'index, follow' );
// cache activation
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
$cache =& mosCache::getCache('com_content');
echo $cache->call('mainframe->getHead', @$_SERVER['QUERY_STRING'], $id);
} else {
echo $mainframe->getHead();
}
if ( isset($mosConfig_sef) && $mosConfig_sef ) {
echo "\r\n";
}
if ($my->id || $mainframe->get( 'joomlaJavascript' )) {
?>
setQuery( $query );
$database->loadObject( $row );
// get params definitions
$syndicateParams = new mosParameters( $row->params, $mainframe->getPath( 'com_xml', $row->option ), 'component' );
// needed to reduce query
$GLOBALS['syndicateParams'] = $syndicateParams;
$live_bookmark = $syndicateParams->get( 'live_bookmark', 0 );
// and to allow disabling/enabling of selected feed types
switch ( $live_bookmark ) {
case 'RSS0.91':
if ( !$syndicateParams->get( 'rss091', 1 ) ) {
$live_bookmark = 0;
}
break;
case 'RSS1.0':
if ( !$syndicateParams->get( 'rss10', 1 ) ) {
$live_bookmark = 0;
}
break;
case 'RSS2.0':
if ( !$syndicateParams->get( 'rss20', 1 ) ) {
$live_bookmark = 0;
}
break;
case 'ATOM0.3':
if ( !$syndicateParams->get( 'atom03', 1 ) ) {
$live_bookmark = 0;
}
break;
}
// support for Live Bookmarks ability for site syndication
if ($live_bookmark) {
$show = 1;
$link_file = $mosConfig_live_site . '/index2.php?option=com_rss&feed='. $live_bookmark .'&no_html=1';
// xhtml check
$link_file = ampReplace( $link_file );
// security chcek
$check = $syndicateParams->def( 'check', 1 );
if($check) {
// test if rssfeed module is published
// if not disable access
$query = "SELECT m.id"
. "\n FROM #__modules AS m"
. "\n WHERE m.module = 'mod_rssfeed'"
. "\n AND m.published = 1"
;
$database->setQuery( $query );
$check = $database->loadResultArray();
if(empty($check)) {
$show = 0;
}
}
// outputs link tag for page
if ($show) {
// test if security check is enbled
?>
|