| 1 |
<?php |
<?php |
| 2 |
/** |
/** |
| 3 |
* @version $Id: content.php,v 1.7 2005/11/24 04:28:51 csouza Exp $ |
* @package Mambo Open Source |
|
* @package Mambo |
|
| 4 |
* @subpackage Content |
* @subpackage Content |
| 5 |
* @copyright (C) 2000 - 2005 Miro International Pty Ltd |
* @copyright (C) 2005 - 2006 Mambo Foundation Inc. |
| 6 |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
| 7 |
|
* |
| 8 |
|
* Mambo was originally developed by Miro (www.miro.com.au) in 2000. Miro assigned the copyright in Mambo to The Mambo Foundation in 2005 to ensure |
| 9 |
|
* that Mambo remained free Open Source software owned and managed by the community. |
| 10 |
* Mambo is Free Software |
* Mambo is Free Software |
| 11 |
*/ |
*/ |
| 12 |
|
|
| 158 |
$query = "SELECT a.*, ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count, u.name AS author, u.usertype, s.name AS section, cc.name AS category, g.name AS groups" |
$query = "SELECT a.*, ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count, u.name AS author, u.usertype, s.name AS section, cc.name AS category, g.name AS groups" |
| 159 |
. "\n FROM #__content AS a" |
. "\n FROM #__content AS a" |
| 160 |
. "\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id" |
. "\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id" |
| 161 |
. "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" |
. "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" |
| 162 |
. "\n INNER JOIN #__sections AS s ON s.id = a.sectionid" |
. "\n LEFT JOIN #__sections AS s ON s.id = a.sectionid" |
| 163 |
. "\n LEFT JOIN #__users AS u ON u.id = a.created_by" |
. "\n LEFT JOIN #__users AS u ON u.id = a.created_by" |
| 164 |
. "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" |
. "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" |
| 165 |
. "\n LEFT JOIN #__groups AS g ON a.access = g.id" |
. "\n LEFT JOIN #__groups AS g ON a.access = g.id" |
| 207 |
$params->def( 'empty_cat', 0 ); |
$params->def( 'empty_cat', 0 ); |
| 208 |
$params->def( 'cat_items', 1 ); |
$params->def( 'cat_items', 1 ); |
| 209 |
$params->def( 'cat_description', 1 ); |
$params->def( 'cat_description', 1 ); |
| 210 |
|
$params->def( 'description', 1 ); |
| 211 |
|
$params->def( 'description-image', 1 ); |
| 212 |
$params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); |
$params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); |
| 213 |
$params->def( 'pageclass_sfx', '' ); |
$params->def( 'pageclass_sfx', '' ); |
| 214 |
|
|
| 308 |
$params->def( 'empty_cat', 0 ); |
$params->def( 'empty_cat', 0 ); |
| 309 |
$params->def( 'cat_items', 1 ); |
$params->def( 'cat_items', 1 ); |
| 310 |
$params->def( 'cat_description', 0 ); |
$params->def( 'cat_description', 0 ); |
| 311 |
|
$params->def( 'description', 1 ); |
| 312 |
|
$params->def( 'description-image', 1 ); |
| 313 |
$params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); |
$params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); |
| 314 |
$params->def( 'pageclass_sfx', '' ); |
$params->def( 'pageclass_sfx', '' ); |
| 315 |
$params->def( 'headings', 1 ); |
$params->def( 'headings', 1 ); |
| 371 |
|
|
| 372 |
// get the total number of published items in the category |
// get the total number of published items in the category |
| 373 |
// filter functionality |
// filter functionality |
| 374 |
$and = ''; |
$_and = ''; |
| 375 |
if ($filter = mosGetParam($_POST, 'filter', '')) { |
if ($filter = mosGetParam($_POST, 'filter', '')) { |
| 376 |
$filter = strtolower( $filter ); |
$filter = strtolower( $filter ); |
| 377 |
$filter = $database->getEscaped($filter); |
$filter = $database->getEscaped($filter); |
| 378 |
if ( $params->get( 'filter' ) ) { |
if ( $params->get( 'filter' ) ) { |
| 379 |
switch ( $params->get( 'filter_type' ) ) { |
switch ( $params->get( 'filter_type' ) ) { |
| 380 |
case 'title': |
case 'title': |
| 381 |
$and = "\n AND LOWER( a.title ) LIKE '%". $filter ."%'"; |
$_and = "\n AND LOWER( a.title ) LIKE '%". $filter ."%'"; |
| 382 |
break; |
break; |
| 383 |
case 'author': |
case 'author': |
| 384 |
$and = "\n AND ( ( LOWER( u.name ) LIKE '%". $filter ."%' ) OR ( LOWER( a.created_by_alias ) LIKE '%". $filter ."%' ) )"; |
$_and = "\n AND ( ( LOWER( u.name ) LIKE '%". $filter ."%' ) OR ( LOWER( a.created_by_alias ) LIKE '%". $filter ."%' ) )"; |
| 385 |
break; |
break; |
| 386 |
case 'hits': |
case 'hits': |
| 387 |
$and = "\n AND a.hits LIKE '%". $filter ."%'"; |
$_and = "\n AND a.hits LIKE '%". $filter ."%'"; |
| 388 |
break; |
break; |
| 389 |
} |
} |
| 390 |
} |
} |
| 407 |
. "\n WHERE a.catid='". $category->id ."' ". $xwhere |
. "\n WHERE a.catid='". $category->id ."' ". $xwhere |
| 408 |
. ( $noauth ? "\n AND a.access<='". $gid ."'" : '' ) |
. ( $noauth ? "\n AND a.access<='". $gid ."'" : '' ) |
| 409 |
. "\n AND '". $category->access ."'<='". $gid ."'" |
. "\n AND '". $category->access ."'<='". $gid ."'" |
| 410 |
. $and |
. $_and |
| 411 |
. "\n ORDER BY ". $orderby ."" |
. "\n ORDER BY ". $orderby ."" |
| 412 |
; |
; |
| 413 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 427 |
. "\n WHERE a.catid='". $category->id ."' ". $xwhere |
. "\n WHERE a.catid='". $category->id ."' ". $xwhere |
| 428 |
. ( $noauth ? "\n AND a.access<='". $gid ."'" : '' ) |
. ( $noauth ? "\n AND a.access<='". $gid ."'" : '' ) |
| 429 |
. "\n AND '". $category->access ."'<='". $gid ."'" |
. "\n AND '". $category->access ."'<='". $gid ."'" |
| 430 |
. $and |
. $_and |
| 431 |
. "\n ORDER BY ". $orderby ."" |
. "\n ORDER BY ". $orderby ."" |
| 432 |
. "\n LIMIT ". $limitstart .", ". $limit |
. "\n LIMIT ". $limitstart .", ". $limit |
| 433 |
; |
; |
| 658 |
echo '<input type="hidden" name="Itemid" value="'. $Itemid .'" />'; |
echo '<input type="hidden" name="Itemid" value="'. $Itemid .'" />'; |
| 659 |
echo '<input type="hidden" name="task" value="archivesection" />'; |
echo '<input type="hidden" name="task" value="archivesection" />'; |
| 660 |
echo '<input type="hidden" name="option" value="com_content" />'; |
echo '<input type="hidden" name="option" value="com_content" />'; |
| 661 |
|
echo '<input type="hidden" name="module" value="1" />'; |
| 662 |
echo '</form>'; |
echo '</form>'; |
| 663 |
} |
} |
| 664 |
|
|
| 740 |
echo '<input type="hidden" name="Itemid" value="'. $Itemid .'" />'; |
echo '<input type="hidden" name="Itemid" value="'. $Itemid .'" />'; |
| 741 |
echo '<input type="hidden" name="task" value="archivecategory" />'; |
echo '<input type="hidden" name="task" value="archivecategory" />'; |
| 742 |
echo '<input type="hidden" name="option" value="com_content" />'; |
echo '<input type="hidden" name="option" value="com_content" />'; |
| 743 |
|
echo '<input type="hidden" name="module" value="1" />'; |
| 744 |
echo '</form>'; |
echo '</form>'; |
| 745 |
} |
} |
| 746 |
|
|
| 1245 |
$row->frontpage = 0; |
$row->frontpage = 0; |
| 1246 |
} |
} |
| 1247 |
|
|
|
|
|
| 1248 |
// calls function to read image from directory |
// calls function to read image from directory |
| 1249 |
$pathA = $mosConfig_absolute_path .'/images/stories'; |
$pathA = $mosConfig_absolute_path .'/images/stories'; |
| 1250 |
$pathL = $mosConfig_live_site .'/images/stories'; |
$pathL = $mosConfig_live_site .'/images/stories'; |
| 1272 |
. "\n ORDER BY ordering" |
. "\n ORDER BY ordering" |
| 1273 |
; |
; |
| 1274 |
$lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $uid, $query, 1 ); |
$lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $uid, $query, 1 ); |
|
|
|
| 1275 |
// build list of categories |
// build list of categories |
| 1276 |
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', $sectionid, intval( $row->catid ) ); |
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', $sectionid, intval( $row->catid ) ); |
| 1277 |
// build the select list for the image positions |
// build the select list for the image positions |
| 1295 |
echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; |
echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; |
| 1296 |
exit(); |
exit(); |
| 1297 |
} |
} |
| 1298 |
|
// sanitize |
| 1299 |
|
$row->id = intval($row->id); |
| 1300 |
|
$row->catid = intval($row->catid); |
| 1301 |
|
$row->sectionid = intval($row->sectionid); |
| 1302 |
$isNew = $row->id < 1; |
$isNew = $row->id < 1; |
| 1303 |
if ( $isNew ) { |
if ( $isNew ) { |
| 1304 |
// new record |
// new record |
| 1407 |
|
|
| 1408 |
$Itemid = mosGetParam( $_POST, 'Returnid', '0' ); |
$Itemid = mosGetParam( $_POST, 'Returnid', '0' ); |
| 1409 |
|
|
|
if ( $Itemid ) { |
|
|
mosRedirect( 'index.php?option=com_content&task=view&id='. $row->id .'&Itemid='. $Itemid ); |
|
|
} else { |
|
| 1410 |
mosRedirect( 'index.php' ); |
mosRedirect( 'index.php' ); |
| 1411 |
} |
} |
|
} |
|
| 1412 |
|
|
| 1413 |
/** |
/** |
| 1414 |
* Shows the email form for a given content item. |
* Shows the email form for a given content item. |