[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: mod_newsflash.php 5071 2006-09-15 16:16:55Z friesengeist $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 6 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // no direct access 15 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 16 17 require_once( $mainframe->getPath( 'front_html', 'com_content') ); 18 19 if (!defined( '_JOS_NEWSFLASH_MODULE' )) { 20 /** ensure that functions are declared only once */ 21 define( '_JOS_NEWSFLASH_MODULE', 1 ); 22 23 function output_newsflash( &$row, &$params, &$access ) { 24 global $mainframe; 25 26 $row->text = $row->introtext; 27 $row->groups = ''; 28 $row->readmore = (trim( $row->fulltext ) != ''); 29 $row->metadesc = ''; 30 $row->metakey = ''; 31 $row->access = ''; 32 $row->created = ''; 33 $row->modified = ''; 34 35 HTML_content::show( $row, $params, $access, 0 ); 36 } 37 } 38 39 global $my, $mosConfig_shownoauth, $mosConfig_offset, $mosConfig_link_titles, $acl; 40 41 // Disable edit ability icon 42 $access = new stdClass(); 43 $access->canEdit = 0; 44 $access->canEditOwn = 0; 45 $access->canPublish = 0; 46 47 $now = _CURRENT_SERVER_TIME; 48 $noauth = !$mainframe->getCfg( 'shownoauth' ); 49 $nullDate = $database->getNullDate(); 50 51 $catid = intval( $params->get( 'catid' ) ); 52 $items = intval( $params->get( 'items', 0 ) ); 53 $style = $params->get( 'style', 'flash' ); 54 $moduleclass_sfx = $params->get( 'moduleclass_sfx' ); 55 $link_titles = $params->get( 'link_titles', $mosConfig_link_titles ); 56 57 $params->set( 'intro_only', 1 ); 58 $params->set( 'hide_author', 1 ); 59 $params->set( 'hide_createdate', 0 ); 60 $params->set( 'hide_modifydate', 1 ); 61 $params->set( 'link_titles', $link_titles ); 62 63 // query to determine article count 64 $query = "SELECT a.id, a.introtext, a.fulltext , a.images, a.attribs, a.title, a.state" 65 ."\n FROM #__content AS a" 66 ."\n INNER JOIN #__categories AS cc ON cc.id = a.catid" 67 ."\n INNER JOIN #__sections AS s ON s.id = a.sectionid" 68 ."\n WHERE a.state = 1" 69 . ( $noauth ? "\n AND a.access <= " . (int) $my->gid . " AND cc.access <= " . (int) $my->gid . " AND s.access <= " . (int) $my->gid : '' ) 70 ."\n AND (a.publish_up = " . $database->Quote( $nullDate ) . " OR a.publish_up <= " . $database->Quote( $now ) . " ) " 71 ."\n AND (a.publish_down = " . $database->Quote( $nullDate ) . " OR a.publish_down >= " . $database->Quote( $now ) . " )" 72 ."\n AND a.catid = " . (int) $catid 73 ."\n AND cc.published = 1" 74 ."\n AND s.published = 1" 75 ."\n ORDER BY a.ordering" 76 ; 77 $database->setQuery( $query, 0, $items ); 78 $rows = $database->loadObjectList(); 79 80 $numrows = count( $rows ); 81 82 // check if any results returned 83 if ( $numrows ) { 84 switch ($style) { 85 case 'horiz': 86 echo '<table class="moduletable' . $moduleclass_sfx .'">'; 87 echo '<tr>'; 88 foreach ($rows as $row) { 89 echo '<td>'; 90 output_newsflash( $row, $params, $access ); 91 echo '</td>'; 92 } 93 echo '</tr></table>'; 94 break; 95 96 case 'vert': 97 foreach ($rows as $row) { 98 output_newsflash( $row, $params, $access ); 99 } 100 break; 101 102 case 'flash': 103 default: 104 srand ((double) microtime() * 1000000); 105 $flashnum = rand( 0, $numrows-1 ); 106 $row = $rows[$flashnum]; 107 108 output_newsflash( $row, $params, $access ); 109 break; 110 } 111 } 112 ?>
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 |
![]() |