get( 'type', 1 ) ); $count = intval( $params->get( 'count', 5 ) ); $catid = trim( $params->get( 'catid' ) ); $secid = trim( $params->get( 'secid' ) ); $hits = trim( $params->get( 'hits' ) ); $show_front = $params->get( 'show_front', 1 ); $class_sfx = $params->get( 'moduleclass_sfx' ); $now = date( 'Y-m-d H:i:s', time()+$mosConfig_offset*60*60 ); $access = !$mainframe->getCfg( 'shownoauth' ); // select between Content Items, Static Content or both switch ( $type ) { case 2: $query = "SELECT a.id, a.title, a.hits" . "\n FROM #__content AS a" . "\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid = '0' )" . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '". $now ."' )" . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '". $now ."' )" . ( $access ? "\n AND a.access <= '". $my->gid ."'" : '' ) . "\n ORDER BY a.hits DESC LIMIT $count" ; $database->setQuery( $query ); $rows = $database->loadObjectList(); break; case 3: $query = "SELECT a.id, a.title, a.sectionid, a.hits" . "\n FROM #__content AS a" . "\n WHERE ( a.state = '1' AND a.checked_out = '0' )" . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '". $now ."' )" . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '". $now ."' )" . ( $access ? "\n AND a.access <= '". $my->gid ."'" : '' ) . "\n ORDER BY a.hits DESC LIMIT $count" ; $database->setQuery( $query ); $rows = $database->loadObjectList(); break; case 1: default: $query = "SELECT a.id, a.title, a.sectionid, a.catid, a.hits" . "\n FROM #__content AS a" . "\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id" . "\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid > '0' )" . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '". $now ."' )" . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '". $now ."' )" . ( $access ? "\n AND a.access <= '". $my->gid ."'" : '' ) . ( $catid ? "\n AND ( a.catid IN (". $catid .") )" : '' ) . ( $secid ? "\n AND ( a.sectionid IN (". $secid .") )" : '' ) . ( $show_front == "0" ? "\n AND f.content_id IS NULL" : '' ) . "\n ORDER BY a.hits DESC LIMIT $count" ; $database->setQuery( $query ); $rows = $database->loadObjectList(); break; } // needed to reduce queries used by getItemid for Content Items if ( ( $type == 1 ) || ( $type == 3 ) ) { require_once(mamboCore::get('mosConfig_absolute_path').'/components/com_content/content.class.php'); $handler =& new contentHandler(); $bs = $handler->getBlogSectionCount(); $bc = $handler->getBlogCategoryCount(); $gbs = $handler->getGlobalBlogSectionCount(); } // Output ?>