| 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 ); |
| 327 |
$sectionid = $category->section; |
$sectionid = $category->section; |
| 328 |
} |
} |
| 329 |
|
|
| 330 |
$pathway = mosPathway::getInstance(); |
$pathway =& mosPathway::getInstance(); |
| 331 |
$pathway->addItem($category->title, categoryURL($sectionid, $id)); |
$pathway->addItem($category->title, categoryURL($sectionid, $id)); |
| 332 |
|
|
| 333 |
if ( $access->canEdit ) { |
if ( $access->canEdit ) { |
| 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 |
|
|
| 1005 |
$row = new mosExtendedContent(); |
$row = new mosExtendedContent(); |
| 1006 |
|
|
| 1007 |
if ( $database->loadObject( $row ) ) { |
if ( $database->loadObject( $row ) ) { |
| 1008 |
$pathway = mosPathway::getInstance(); |
$pathway =& mosPathway::getInstance(); |
| 1009 |
$pathway->addItem($row->category, categoryURL($row->sectionid, $row->catid)); |
$pathway->addItem($row->category, categoryURL($row->sectionid, $row->catid)); |
| 1010 |
$pathway->addItem($row->title, ''); |
$pathway->addItem($row->title, ''); |
| 1011 |
$params =& new mosParameters( $row->attribs ); |
$params =& new mosParameters( $row->attribs ); |
| 1113 |
if ( $params->get( 'section_link' ) ) { |
if ( $params->get( 'section_link' ) ) { |
| 1114 |
$query = "SELECT a.id" |
$query = "SELECT a.id" |
| 1115 |
. "\n FROM #__menu AS a" |
. "\n FROM #__menu AS a" |
| 1116 |
. "\n WHERE a.componentid = ". $row->sectionid."" |
. "\n WHERE a.componentid = '". $row->sectionid."'" |
| 1117 |
|
. "\n AND a.type = 'content_section'" |
| 1118 |
|
. "\n AND a.published = 1" |
| 1119 |
; |
; |
| 1120 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 1121 |
$_Itemid = $database->loadResult(); |
$_Itemid = $database->loadResult(); |
| 1122 |
|
if (!intval($_Itemid)) |
| 1123 |
|
$_Itemid = intval($Itemid) ? intval($Itemid) : 1; |
| 1124 |
$link = sefRelToAbs( 'index.php?option=com_content&task=section&id='. $row->sectionid .'&Itemid='.$_Itemid ); |
$link = sefRelToAbs( 'index.php?option=com_content&task=section&id='. $row->sectionid .'&Itemid='.$_Itemid ); |
| 1125 |
$row->section = '<a href="'. $link .'">'. $row->section .'</a>'; |
$row->section = '<a href="'. $link .'">'. $row->section .'</a>'; |
| 1126 |
} |
} |
| 1130 |
$query = "SELECT a.id" |
$query = "SELECT a.id" |
| 1131 |
. "\n FROM #__menu AS a" |
. "\n FROM #__menu AS a" |
| 1132 |
. "\n WHERE a.componentid = ". $row->catid."" |
. "\n WHERE a.componentid = ". $row->catid."" |
| 1133 |
|
. "\n AND a.type = 'content_category'" |
| 1134 |
|
. "\n AND a.published = 1" |
| 1135 |
; |
; |
| 1136 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 1137 |
$_Itemid = $database->loadResult(); |
$_Itemid = $database->loadResult(); |
| 1138 |
|
if (!intval($_Itemid)) |
| 1139 |
|
$_Itemid = intval($Itemid) ? intval($Itemid) : 1; |
| 1140 |
|
$link = sefRelToAbs( 'index.php?option=com_content&task=section&id='. $row->sectionid .'&Itemid='.$_Itemid ); |
| 1141 |
$link = sefRelToAbs( 'index.php?option=com_content&task=category&sectionid='. $row->sectionid .'&id='. $row->catid .'&Itemid='.$_Itemid ); |
$link = sefRelToAbs( 'index.php?option=com_content&task=category&sectionid='. $row->sectionid .'&id='. $row->catid .'&Itemid='.$_Itemid ); |
| 1142 |
$row->category = '<a href="'. $link .'">'. $row->category .'</a>'; |
$row->category = '<a href="'. $link .'">'. $row->category .'</a>'; |
| 1143 |
} |
} |
| 1254 |
$row->frontpage = 0; |
$row->frontpage = 0; |
| 1255 |
} |
} |
| 1256 |
|
|
|
|
|
| 1257 |
// calls function to read image from directory |
// calls function to read image from directory |
| 1258 |
$pathA = $mosConfig_absolute_path .'/images/stories'; |
$pathA = $mosConfig_absolute_path .'/images/stories'; |
| 1259 |
$pathL = $mosConfig_live_site .'/images/stories'; |
$pathL = $mosConfig_live_site .'/images/stories'; |
| 1281 |
. "\n ORDER BY ordering" |
. "\n ORDER BY ordering" |
| 1282 |
; |
; |
| 1283 |
$lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $uid, $query, 1 ); |
$lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $uid, $query, 1 ); |
|
|
|
| 1284 |
// build list of categories |
// build list of categories |
| 1285 |
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', $sectionid, intval( $row->catid ) ); |
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', $sectionid, intval( $row->catid ) ); |
| 1286 |
// build the select list for the image positions |
// build the select list for the image positions |
| 1304 |
echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; |
echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; |
| 1305 |
exit(); |
exit(); |
| 1306 |
} |
} |
| 1307 |
|
// sanitize |
| 1308 |
|
$row->id = intval($row->id); |
| 1309 |
|
$row->catid = intval($row->catid); |
| 1310 |
|
$row->sectionid = intval($row->sectionid); |
| 1311 |
$isNew = $row->id < 1; |
$isNew = $row->id < 1; |
| 1312 |
if ( $isNew ) { |
if ( $isNew ) { |
| 1313 |
// new record |
// new record |
| 1385 |
if ( $isNew ) { |
if ( $isNew ) { |
| 1386 |
// messaging for new items |
// messaging for new items |
| 1387 |
require_once( $mosConfig_absolute_path .'/components/com_messages/messages.class.php' ); |
require_once( $mosConfig_absolute_path .'/components/com_messages/messages.class.php' ); |
|
|
|
| 1388 |
$database->setQuery( "SELECT id FROM #__users WHERE sendEmail = '1'" ); |
$database->setQuery( "SELECT id FROM #__users WHERE sendEmail = '1'" ); |
| 1389 |
$users = $database->loadResultArray(); |
$users = $database->loadResultArray(); |
| 1390 |
|
if ($users) { |
| 1391 |
foreach ($users as $user_id) { |
foreach ($users as $user_id) { |
| 1392 |
$msg = new mosMessage( $database ); |
$msg = new mosMessage( $database ); |
| 1393 |
$msg->send( $my->id, $user_id, T_("New Item"), sprintf( T_('A new content item has been submitted by [ %s ] titled [ %s ] from section [ %s ] and category [ %s ]'), $my->username, $row->title, $section, $category ) ); |
$msg->send( $my->id, $user_id, T_("New Item"), sprintf( T_('A new content item has been submitted by [ %s ] titled [ %s ] from section [ %s ] and category [ %s ]'), $my->username, $row->title, $section, $category ) ); |
| 1394 |
} |
} |
| 1395 |
} |
} |
| 1396 |
|
} |
| 1397 |
$Itemid = mosGetParam( $_POST, 'Returnid', '0' ); |
$Itemid = mosGetParam( $_POST, 'Returnid', '0' ); |
| 1398 |
$msg = $isNew ? T_('Thanks for your submission; it will be reviewed before being posted to the site.') : T_('Item saved successfully.'); |
$msg = $isNew ? T_('Thanks for your submission; it will be reviewed before being posted to the site.') : T_('Item saved successfully.'); |
| 1399 |
mosRedirect( 'index.php', $msg ); |
mosRedirect( 'index.php', $msg ); |
| 1416 |
|
|
| 1417 |
$Itemid = mosGetParam( $_POST, 'Returnid', '0' ); |
$Itemid = mosGetParam( $_POST, 'Returnid', '0' ); |
| 1418 |
|
|
|
if ( $Itemid ) { |
|
|
mosRedirect( 'index.php?option=com_content&task=view&id='. $row->id .'&Itemid='. $Itemid ); |
|
|
} else { |
|
| 1419 |
mosRedirect( 'index.php' ); |
mosRedirect( 'index.php' ); |
| 1420 |
} |
} |
|
} |
|
| 1421 |
|
|
| 1422 |
/** |
/** |
| 1423 |
* Shows the email form for a given content item. |
* Shows the email form for a given content item. |
| 1456 |
$subject_default = sprintf(T_('Item sent by %s'), $yourname); |
$subject_default = sprintf(T_('Item sent by %s'), $yourname); |
| 1457 |
$subject = trim( mosGetParam( $_POST, 'subject', $subject_default ) ); |
$subject = trim( mosGetParam( $_POST, 'subject', $subject_default ) ); |
| 1458 |
|
|
| 1459 |
|
session_start(); |
| 1460 |
$form_check = mosGetParam( $_POST, 'form_check', '' ); |
$form_check = mosGetParam( $_POST, 'form_check', '' ); |
| 1461 |
if (empty($_SESSION['_form_check_']['com_content']) || $form_check != $_SESSION['_form_check_']['com_content']) { |
if (empty($_SESSION['_form_check_']['com_content']) || $form_check != $_SESSION['_form_check_']['com_content']) { |
| 1462 |
// the form hasn't been generated by the server on this session |
// the form hasn't been generated by the server on this session |