[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** module to display newsfeeds 3 * version $Id: newsfeeds.php 5072 2006-09-15 16:24:06Z friesengeist $ 4 * @package Joomla 5 * @subpackage Newsfeeds 6 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 7 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 8 * modified by brian & rob 9 * Joomla! is free software. This version may have been modified pursuant 10 * to the GNU General Public License, and as distributed it includes or 11 * is derivative of works licensed under the GNU General Public License or 12 * other free or open source software licenses. 13 * See COPYRIGHT.php for copyright notices and details. 14 */ 15 16 // no direct access 17 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 18 19 // load the html drawing class 20 require_once( $mainframe->getPath( 'front_html' ) ); 21 22 $feedid = intval( mosGetParam( $_REQUEST ,'feedid', 0 ) ); 23 $catid = intval( mosGetParam( $_REQUEST ,'catid', 0 ) ); 24 25 switch( $task ) { 26 case 'view': 27 showFeed( $feedid ); 28 break; 29 30 default: 31 listFeeds( $catid ); 32 break; 33 } 34 35 36 function listFeeds( $catid ) { 37 global $mainframe, $database, $my; 38 global $mosConfig_live_site; 39 global $Itemid; 40 41 /* Query to retrieve all categories that belong under the contacts section and that are published. */ 42 $query = "SELECT cc.*, a.catid, COUNT(a.id) AS numlinks" 43 . "\n FROM #__categories AS cc" 44 . "\n LEFT JOIN #__newsfeeds AS a ON a.catid = cc.id" 45 . "\n WHERE a.published = 1" 46 . "\n AND cc.section = 'com_newsfeeds'" 47 . "\n AND cc.published = 1" 48 . "\n AND cc.access <= " . (int) $my->gid 49 . "\n GROUP BY cc.id" 50 . "\n ORDER BY cc.ordering" 51 ; 52 $database->setQuery( $query ); 53 $categories = $database->loadObjectList(); 54 55 $rows = array(); 56 $currentcat = NULL; 57 if ( $catid ) { 58 // url links info for category 59 $query = "SELECT *" 60 . "\n FROM #__newsfeeds" 61 . "\n WHERE catid = " . (int) $catid 62 . "\n AND published = 1" 63 . "\n ORDER BY ordering" 64 ; 65 $database->setQuery( $query ); 66 $rows = $database->loadObjectList(); 67 68 // current category info 69 $query = "SELECT id, name, description, image, image_position" 70 . "\n FROM #__categories" 71 . "\n WHERE id = " . (int) $catid 72 . "\n AND published = 1" 73 . "\n AND access <= " . (int) $my->gid 74 ; 75 $database->setQuery( $query ); 76 $database->loadObject( $currentcat ); 77 78 /* 79 Check if the category is published or if access level allows access 80 */ 81 if (!$currentcat->name) { 82 mosNotAuth(); 83 return; 84 } 85 } 86 87 // Parameters 88 $menu = $mainframe->get( 'menu' ); 89 $params = new mosParameters( $menu->params ); 90 91 $params->def( 'page_title', 1 ); 92 $params->def( 'header', $menu->name ); 93 $params->def( 'pageclass_sfx', '' ); 94 $params->def( 'headings', 1 ); 95 $params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); 96 $params->def( 'description_text', '' ); 97 $params->def( 'image', -1 ); 98 $params->def( 'image_align', 'right' ); 99 $params->def( 'other_cat_section', 1 ); 100 // Category List Display control 101 $params->def( 'other_cat', 1 ); 102 $params->def( 'cat_description', 1 ); 103 $params->def( 'cat_items', 1 ); 104 // Table Display control 105 $params->def( 'headings', 1 ); 106 $params->def( 'name', 1 ); 107 $params->def( 'articles', 1 ); 108 $params->def( 'link', 0 ); 109 110 if ( $catid ) { 111 $params->set( 'type', 'category' ); 112 } else { 113 $params->set( 'type', 'section' ); 114 } 115 116 // page description 117 $currentcat->descrip = ''; 118 if( ( @$currentcat->description ) != '' ) { 119 $currentcat->descrip = $currentcat->description; 120 } else if ( !$catid ) { 121 // show description 122 if ( $params->get( 'description' ) ) { 123 $currentcat->descrip = $params->get( 'description_text' ); 124 } 125 } 126 127 // page image 128 $currentcat->img = ''; 129 $path = $mosConfig_live_site .'/images/stories/'; 130 if ( ( @$currentcat->image ) != '' ) { 131 $currentcat->img = $path . $currentcat->image; 132 $currentcat->align = $currentcat->image_position; 133 } else if ( !$catid ) { 134 if ( $params->get( 'image' ) != -1 ) { 135 $currentcat->img = $path . $params->get( 'image' ); 136 $currentcat->align = $params->get( 'image_align' ); 137 } 138 } 139 140 // page header 141 $currentcat->header = ''; 142 if ( @$currentcat->name != '' ) { 143 $currentcat->header = $currentcat->name; 144 } else { 145 $currentcat->header = $params->get( 'header' ); 146 } 147 148 // used to show table rows in alternating colours 149 $tabclass = array( 'sectiontableentry1', 'sectiontableentry2' ); 150 151 $mainframe->SetPageTitle( $menu->name ); 152 153 HTML_newsfeed::displaylist( $categories, $rows, $catid, $currentcat, $params, $tabclass ); 154 } 155 156 157 function showFeed( $feedid ) { 158 global $database, $mainframe, $mosConfig_absolute_path, $mosConfig_cachepath, $Itemid, $my; 159 160 // check if cache directory is writeable 161 $cacheDir = $mosConfig_cachepath .'/'; 162 if ( !is_writable( $cacheDir ) ) { 163 echo 'Cache Directory Unwriteable'; 164 return; 165 } 166 167 require_once( $mainframe->getPath( 'class' ) ); 168 169 $newsfeed = new mosNewsFeed($database); 170 $newsfeed->load((int)$feedid); 171 172 /* 173 * Check if newsfeed is published 174 */ 175 if(!$newsfeed->published) { 176 mosNotAuth(); 177 return; 178 } 179 180 $category = new mosCategory($database); 181 $category->load((int)$newsfeed->catid); 182 183 /* 184 * Check if newsfeed category is published 185 */ 186 if(!$category->published) { 187 mosNotAuth(); 188 return; 189 } 190 /* 191 * check whether category access level allows access 192 */ 193 if ( $category->access > $my->gid ) { 194 mosNotAuth(); 195 return; 196 } 197 198 // full RSS parser used to access image information 199 require_once ( $mosConfig_absolute_path . '/includes/domit/xml_domit_rss.php'); 200 $LitePath = $mosConfig_absolute_path . '/includes/Cache/Lite.php'; 201 202 // Adds parameter handling 203 $menu = $mainframe->get( 'menu' ); 204 $params = new mosParameters( $menu->params ); 205 $params->def( 'page_title', 1 ); 206 $params->def( 'header', $menu->name ); 207 $params->def( 'pageclass_sfx', '' ); 208 $params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); 209 // Feed Display control 210 $params->def( 'feed_image', 1 ); 211 $params->def( 'feed_descr', 1 ); 212 $params->def( 'item_descr', 1 ); 213 $params->def( 'word_count', 0 ); 214 // Encoding 215 $params->def( 'utf8', 1 ); 216 217 if ( !$params->get( 'page_title' ) ) { 218 $params->set( 'header', '' ); 219 } 220 221 $and = ''; 222 if ( $feedid ) { 223 $and = "\n AND id = $feedid"; 224 } 225 226 $mainframe->SetPageTitle($menu->name); 227 228 HTML_newsfeed::showNewsfeeds( $newsfeed, $LitePath, $cacheDir, $params ); 229 } 230 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |