| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** ensure this file is being included by a parent file */ 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 19 global $mosConfig_offset, $mosConfig_live_site, $mainframe, $acl, $my; 20 require_once(mamboCore::get('mosConfig_absolute_path').'/components/com_content/content.html.php'); 21 22 $type = intval( $params->get( 'type', 1 ) ); 23 $count = intval( $params->get( 'count', 5 ) ); 24 $catid = trim( $params->get( 'catid' ) ); 25 $secid = trim( $params->get( 'secid' ) ); 26 $show_front = $params->get( 'show_front', 1 ); 27 $class_sfx = $params->get( 'moduleclass_sfx' ); 28 $style = $params->get( 'style' ); 29 $readmore = $params->get( 'readmore',0 ); 30 $image = $params->get( 'image' ); 31 32 $params->set( 'intro_only', 1 ); 33 $params->set( 'hide_author', 1 ); 34 $params->set( 'hide_createdate', 0 ); 35 $params->set( 'hide_modifydate', 1 ); 36 37 38 $now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); 39 40 //$access = !$mainframe->getCfg( 'shownoauth' ); 41 // Disable edit ability icon 42 $access = new stdClass(); 43 $access->canEdit = 0; 44 $access->canEditOwn = 0; 45 $access->canPublish = 0; 46 47 48 $viewAccess = ($my->gid >= $acl->get_group_id( 'Registered', 'ARO' ) ? 1 : 0) + ($my->gid >= $acl->get_group_id( 'Author', 'ARO' ) ? 1 : 0); 49 50 // select between Content Items, Static Content or both 51 switch ( $type ) { 52 case 2: //Static Content only 53 $query = "SELECT a.id, a.title" 54 . "\n FROM #__content AS a" 55 . "\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid = '0' )" 56 . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '". $now ."' )" 57 . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '". $now ."' )" 58 . ( $access ? "\n AND a.access <= '". $viewAccess ."'" : '' ) 59 . "\n ORDER BY a.created DESC LIMIT $count" 60 ; 61 $database->setQuery( $query ); 62 $rows = $database->loadObjectList(); 63 break; 64 65 case 3: //Both 66 $query = "SELECT a.id, a.title, a.sectionid" 67 . "\n FROM #__content AS a" 68 . "\n WHERE ( a.state = '1' AND a.checked_out = '0' )" 69 . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '". $now ."' )" 70 . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '". $now ."' )" 71 . ( $access ? "\n AND a.access <= '". $viewAccess ."'" : '' ) 72 . "\n ORDER BY a.created DESC LIMIT $count" 73 ; 74 $database->setQuery( $query ); 75 $rows = $database->loadObjectList(); 76 break; 77 78 case 1: //Content Items only 79 default: 80 $query = "SELECT a.id, a.title, a.sectionid, a.catid" 81 . "\n FROM #__content AS a" 82 . "\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id" 83 . "\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid > '0' )" 84 . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '". $now ."' )" 85 . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '". $now ."' )" 86 . ( $access ? "\n AND a.access <= '". $viewAccess ."'" : '' ) // original code 87 . ( $catid ? "\n AND ( a.catid IN (". $catid .") )" : '' ) 88 . ( $secid ? "\n AND ( a.sectionid IN (". $secid .") )" : '' ) 89 . ( $show_front == "0" ? "\n AND f.content_id IS NULL" : '' ) 90 . "\n ORDER BY a.created DESC LIMIT $count" 91 ; 92 $database->setQuery( $query ); 93 $rows = $database->loadObjectList(); 94 break; 95 } 96 97 // needed to reduce queries used by getItemid for Content Items 98 if ( ( $type == 1 ) || ( $type == 3 ) ) { 99 require_once(mamboCore::get('mosConfig_absolute_path').'/components/com_content/content.class.php'); 100 $handler =& new contentHandler(); 101 $bs = $handler->getBlogSectionCount(); 102 $bc = $handler->getBlogCategoryCount(); 103 $gbs = $handler->getGlobalBlogSectionCount(); 104 } 105 106 // Output 107 108 $newrow = new mosContent( $database ); 109 110 if ($rows) { 111 112 switch ( $style ) { 113 case 'vert': 114 echo "\n<table class=\"moduletable" . $class_sfx . "\">\n"; 115 116 117 foreach ( $rows as $row ) { 118 // get Itemid 119 switch ( $type ) { 120 case 2://Static Content only 121 $query = "SELECT id" 122 . "\n FROM #__menu" 123 . "\n WHERE type = 'content_typed'" 124 . "\n AND componentid = $row->id" 125 ; 126 $database->setQuery( $query ); 127 $Itemid = $database->loadResult(); 128 break; 129 130 case 3://Both 131 if ( $row->sectionid ) { 132 $Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs ); 133 } else { 134 $query = "SELECT id" 135 . "\n FROM #__menu" 136 . "\n WHERE type = 'content_typed'" 137 . "\n AND componentid = $row->id" 138 ; 139 $database->setQuery( $query ); 140 $Itemid = $database->loadResult(); 141 } 142 break; 143 144 case 1://Content Items only 145 default: 146 //$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs ); 147 $query = "SELECT id" 148 . "\n FROM #__menu" 149 . "\n WHERE " 150 . "\n link LIKE '%task=section&id=".$row->sectionid."%'" 151 . "\n OR link LIKE '%sectionid=".$row->sectionid."%'" 152 ; 153 $database->setQuery( $query ); 154 $Itemid = $database->loadResult(); 155 break; 156 } 157 158 // Blank itemid checker for SEF 159 /* 160 if ($Itemid == NULL) { 161 $Itemid = ''; 162 } else { 163 $Itemid = '&Itemid='. $Itemid; 164 } 165 */ 166 167 $link = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid); 168 echo "<tr>\n<td valign='top'>\n"; 169 //echo '<a href="'.$link.'">'.$row->title.'</a>'."\n"; 170 $newrow->load( $row->id ); 171 $newrow->text = $newrow->introtext; 172 $newrow->groups = ''; 173 $ItemidCount = array('bc'=>$bc, 'bs'=>$bs, 'gbs'=>$gbs); 174 HTML_content::show( $newrow, $params, $access, 0, 'com_content',$ItemidCount); 175 //print_r($ItemidCount); 176 //echo '<a href="'.$link.'">Read More..</a>'."\n"; 177 echo "</td>\n</tr>\n"; 178 } 179 echo "</table>\n"; 180 break; 181 182 183 case 'horiz': 184 default: 185 186 echo "\n<table class=\"moduletable" . $class_sfx . "\">\n"; 187 echo "<tr>\n"; 188 foreach ( $rows as $row ) { 189 // get Itemid 190 switch ( $type ) { 191 case 2://Static Content only 192 $query = "SELECT id" 193 . "\n FROM #__menu" 194 . "\n WHERE type = 'content_typed'" 195 . "\n AND componentid = $row->id" 196 ; 197 $database->setQuery( $query ); 198 $Itemid = $database->loadResult(); 199 break; 200 201 case 3://Both 202 if ( $row->sectionid ) { 203 $Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs ); 204 } else { 205 $query = "SELECT id" 206 . "\n FROM #__menu" 207 . "\n WHERE type = 'content_typed'" 208 . "\n AND componentid = $row->id" 209 ; 210 $database->setQuery( $query ); 211 $Itemid = $database->loadResult(); 212 } 213 break; 214 215 case 1://Content Items only 216 default: 217 //$Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs ); 218 $query = "SELECT id" 219 . "\n FROM #__menu" 220 . "\n WHERE " 221 . "\n link LIKE '%task=section&id=".$row->sectionid."%'" 222 . "\n OR link LIKE '%sectionid=".$row->sectionid."%'" 223 ; 224 $database->setQuery( $query ); 225 $Itemid = $database->loadResult(); 226 break; 227 } 228 229 // Blank itemid checker for SEF 230 /* 231 if ($Itemid == NULL) { 232 $Itemid = ''; 233 } else { 234 $Itemid = '&Itemid='. $Itemid; 235 } 236 */ 237 238 $link = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid); 239 echo "<td valign='top'>\n"; 240 //echo '<a href="'.$link.'">'.$row->title.'</a>'."\n"; 241 $newrow->load( $row->id ); 242 $newrow->text = $newrow->introtext; 243 $newrow->groups = ''; 244 $ItemidCount = array('bc'=>$bc, 'bs'=>$bs, 'gbs'=>$gbs); 245 //$params->set( 'readmore', 0 ); 246 HTML_content::show( $newrow, $params, $access, 0, 'com_content', $ItemidCount); 247 //print_r($ItemidCount); 248 //echo '<a class="readon" href="'.$link.'">Read More..</a>'."\n"; 249 echo "</td>\n"; 250 } 251 echo "</tr>\n</table>\n"; 252 break; 253 } 254 255 } 256 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |