| 2 |
/** |
/** |
| 3 |
* @package Mambo |
* @package Mambo |
| 4 |
* @subpackage Content |
* @subpackage Content |
|
* @copyright Refer to copyright.php |
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
|
| 5 |
* @author Mambo Foundation Inc see README.php |
* @author Mambo Foundation Inc see README.php |
| 6 |
|
* @copyright Mambo Foundation Inc. |
| 7 |
|
* See COPYRIGHT.php for copyright notices and details. |
| 8 |
|
* @license GNU/GPL Version 2, see LICENSE.php |
| 9 |
|
* Mambo is free software; you can redistribute it and/or |
| 10 |
|
* modify it under the terms of the GNU General Public License |
| 11 |
|
* as published by the Free Software Foundation; version 2 of the License. |
| 12 |
*/ |
*/ |
| 13 |
|
|
| 14 |
/** ensure this file is being included by a parent file */ |
/** ensure this file is being included by a parent file */ |
| 38 |
// loads function for frontpage component |
// loads function for frontpage component |
| 39 |
if ( $option == 'com_frontpage' ) { |
if ( $option == 'com_frontpage' ) { |
| 40 |
//frontpage( $option, $gid, $pop, $now ); |
//frontpage( $option, $gid, $pop, $now ); |
| 41 |
$cache->call( 'frontpage', $gid, $access, $pop, $now ); |
$cache->call( 'frontpage', $gid, $access, $pop, $limit, $limitstart); |
| 42 |
return; |
return; |
| 43 |
} |
} |
| 44 |
|
|
| 52 |
break; |
break; |
| 53 |
|
|
| 54 |
case 'section': |
case 'section': |
| 55 |
$cache->call( 'showSection', $id, $gid, $access, $now ); |
$cache->call( 'showSection', $id, $gid, $access ); |
| 56 |
break; |
break; |
| 57 |
|
|
| 58 |
case 'category': |
case 'category': |
| 59 |
$cache->call( 'showCategory', $id, $gid, $access, $sectionid, $limit, $limitstart, $now ); |
$cache->call( 'showCategory', $id, $gid, $access, $sectionid, $limit, $limitstart ); |
| 60 |
break; |
break; |
| 61 |
|
|
| 62 |
case 'blogsection': |
case 'blogsection': |
| 63 |
$cache->call('showBlogSection', $id, $gid, $access, $pop, $now ); |
$cache->call('showBlogSection', $id, $gid, $access, $pop, $limit, $limitstart ); |
| 64 |
break; |
break; |
| 65 |
|
|
| 66 |
case 'blogcategorymulti': |
case 'blogcategorymulti': |
| 67 |
case 'blogcategory': |
case 'blogcategory': |
| 68 |
$cache->call( 'showBlogCategory', $id, $gid, $access, $pop, $now ); |
$cache->call( 'showBlogCategory', $id, $gid, $access, $pop, $limit, $limitstart ); |
| 69 |
break; |
break; |
| 70 |
|
|
| 71 |
case 'archivesection': |
case 'archivesection': |
| 102 |
break; |
break; |
| 103 |
|
|
| 104 |
case 'vote': |
case 'vote': |
| 105 |
recordVote ( $url , $user_rating , $cid , $database); |
recordVote ( $user_rating , $cid , $database); |
| 106 |
break; |
break; |
| 107 |
|
|
| 108 |
default: |
default: |
| 109 |
$cache->call('showBlogSection', 0, $gid, $access, $pop, $now ); |
$cache->call('showBlogSection', 0, $gid, $access, $pop, $limit, $limitstart ); |
| 110 |
break; |
break; |
| 111 |
} |
} |
| 112 |
|
|
| 136 |
} |
} |
| 137 |
} |
} |
| 138 |
|
|
| 139 |
function frontpage( $gid, &$access, $pop, $now ) { |
function frontpage( $gid, &$access, $pop, $limit, $limitstart) { |
| 140 |
global $database, $mainframe, $my, $Itemid; |
global $database, $mainframe, $my, $Itemid; |
| 141 |
global $mosConfig_offset; |
global $mosConfig_offset; |
| 142 |
|
|
| 148 |
$params =& new mosParameters( $menu->params ); |
$params =& new mosParameters( $menu->params ); |
| 149 |
$orderby_sec = $params->def( 'orderby_sec', '' ); |
$orderby_sec = $params->def( 'orderby_sec', '' ); |
| 150 |
$orderby_pri = $params->def( 'orderby_pri', '' ); |
$orderby_pri = $params->def( 'orderby_pri', '' ); |
| 151 |
|
$header = $params->def( 'header', $menu->name ); |
| 152 |
|
$page_title = $params->def( 'page_title', 0 ); |
| 153 |
// Ordering control |
// Ordering control |
| 154 |
$order_sec = _orderby_sec( $orderby_sec ); |
$order_sec = _orderby_sec( $orderby_sec ); |
| 155 |
$order_pri = _orderby_pri( $orderby_pri ); |
$order_pri = _orderby_pri( $orderby_pri ); |
| 156 |
|
|
| 157 |
$now = date( "Y-m-d H:i:s", time()+$mosConfig_offset*60*60 ); |
$now = date( "Y-m-d H:i:s", time()+$mosConfig_offset*60*60 ); |
| 158 |
|
|
|
// temporary workaround for special access - alwarren 20070207 |
|
| 159 |
global $acl; |
global $acl; |
| 160 |
$viewAccess = ($gid >= $acl->get_group_id( 'Registered', 'ARO' ) ? 1 : 0) + ($gid >= $acl->get_group_id( 'Author', 'ARO' ) ? 1 : 0); |
$viewAccess = ($gid >= $acl->get_group_id( 'Registered', 'ARO' ) ? 1 : 0) + ($gid >= $acl->get_group_id( 'Author', 'ARO' ) ? 1 : 0); |
|
// end special access workaround |
|
| 161 |
// query records |
// query records |
| 162 |
$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" |
| 163 |
. "\n FROM #__content AS a" |
. "\n FROM #__content AS a" |
| 171 |
. ( $noauth ? "\n AND a.access <= '". $my->gid ."'" : '' ) |
. ( $noauth ? "\n AND a.access <= '". $my->gid ."'" : '' ) |
| 172 |
. "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' )" |
. "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' )" |
| 173 |
. "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )" |
. "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )" |
|
// temporary workaround for special access - alwarren 20070207 |
|
| 174 |
. "\n AND a.access <= ". $viewAccess |
. "\n AND a.access <= ". $viewAccess |
|
// end special access workaround |
|
| 175 |
. "\n ORDER BY ". $order_pri . $order_sec |
. "\n ORDER BY ". $order_pri . $order_sec |
| 176 |
; |
; |
|
// $database->setQuery( $query ); |
|
|
// $rows = $database->loadObjectList(); |
|
| 177 |
$rows = $database->doSQLget($query, 'mosExtendedContent'); |
$rows = $database->doSQLget($query, 'mosExtendedContent'); |
| 178 |
|
|
| 179 |
// Dynamic Page Title |
// Dynamic Page Title |
| 180 |
$mainframe->SetPageTitle( $menu->name ); |
$mainframe->SetPageTitle( $header ); |
| 181 |
|
|
| 182 |
BlogOutput( $rows, $params, $gid, $access, $pop, $menu ); |
BlogOutput( $rows, $params, $gid, $access, $pop, $menu, null, $limit, $limitstart ); |
| 183 |
} |
} |
| 184 |
|
|
| 185 |
|
|
| 186 |
function showSection( $id, $gid, &$access, $now ) { |
function showSection( $id, $gid, &$access ) { |
| 187 |
global $database, $mainframe, $mosConfig_offset, $Itemid; |
global $database, $mainframe, $mosConfig_offset, $Itemid; |
| 188 |
|
|
| 189 |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
| 190 |
|
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
| 191 |
// Paramters |
// Paramters |
| 192 |
$params = new stdClass(); |
$params = new stdClass(); |
| 193 |
if ( $Itemid ) { |
if ( $Itemid ) { |
| 196 |
$params =& new mosParameters( $menu->params ); |
$params =& new mosParameters( $menu->params ); |
| 197 |
} else { |
} else { |
| 198 |
$menu = ""; |
$menu = ""; |
| 199 |
$params =& new mosEmpty(); |
$params =& new mosParameters( $menu->params ); |
| 200 |
|
|
| 201 |
} |
} |
| 202 |
$orderby = $params->get( 'orderby', '' ); |
$orderby = $params->get( 'orderby', '' ); |
| 272 |
* @param int The number of items to dislpay |
* @param int The number of items to dislpay |
| 273 |
* @param int The offset for pagination |
* @param int The offset for pagination |
| 274 |
*/ |
*/ |
| 275 |
function showCategory( $id, $gid, &$access, $sectionid, $limit, $limitstart, $now ) { |
function showCategory( $id, $gid, &$access, $sectionid, $limit, $limitstart ) { |
| 276 |
global $database, $mainframe, $Itemid, $mosConfig_offset, $mosConfig_list_limit; |
global $database, $mainframe, $Itemid, $mosConfig_offset, $mosConfig_list_limit; |
| 277 |
|
|
| 278 |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
| 279 |
$selected = mosGetParam( $_POST, 'order', '' ); |
$selected = mosGetParam( $_POST, 'order', '' ); |
| 280 |
|
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
| 281 |
// Paramters |
// Paramters |
| 282 |
$params = new stdClass(); |
$params = new stdClass(); |
| 283 |
if ( $Itemid ) { |
if ( $Itemid ) { |
| 475 |
} // showCategory |
} // showCategory |
| 476 |
|
|
| 477 |
|
|
| 478 |
function showBlogSection( $id=0, $gid, &$access, $pop, $now=NULL ) { |
function showBlogSection( $id=0, $gid, &$access, $pop, $limit, $limitstart ) { |
| 479 |
global $database, $mainframe, $mosConfig_offset, $Itemid; |
global $database, $mainframe, $mosConfig_offset, $Itemid, $option, $task; |
| 480 |
|
|
| 481 |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
| 482 |
|
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
| 483 |
// Parameters |
// Parameters |
| 484 |
$params = new stdClass(); |
$pageTitle = ''; |
| 485 |
if ( $Itemid ) { |
if ( $Itemid ) { |
| 486 |
$menu = new mosMenu( $database ); |
$menu = new mosMenu( $database ); |
| 487 |
$menu->load( $Itemid ); |
$menu->load( $Itemid ); |
| 488 |
$params =& new mosParameters( $menu->params ); |
if ( strpos(strtolower($menu->link), 'blogsection') === false ) { |
| 489 |
|
$menu = ''; |
| 490 |
} else { |
} else { |
| 491 |
$menu = ""; |
// only load params and set title if the menu item loaded is a blog section |
| 492 |
$params =& new mosParameters( '' ); |
$pageTitle = $menu->name; |
| 493 |
|
$params =& new mosParameters( $menu->params ); |
| 494 |
} |
} |
| 495 |
|
} |
| 496 |
|
|
| 497 |
|
// no Itemid OR menu item loaded is not a blog section |
| 498 |
|
// try to find a blog entry in the menu database |
| 499 |
|
if (!$menu) { |
| 500 |
|
$database->setQuery("SELECT * FROM #__menu WHERE link LIKE '%blogsection%'"); |
| 501 |
|
$rows = $database->loadObjectList(); |
| 502 |
|
if (count($rows)) { |
| 503 |
|
$params =& new mosParameters( $rows[0]->params ); |
| 504 |
|
} |
| 505 |
|
} |
| 506 |
|
|
| 507 |
|
// no menu item found and no params loaded so create a default params object |
| 508 |
|
if (!$params) $params =& new mosParameters( $menu->params ); |
| 509 |
|
|
| 510 |
// new blog multiple section handling |
// new blog multiple section handling |
| 511 |
if ( !$id ) { |
if ( !$id ) { |
| 521 |
$order_pri = _orderby_pri( $orderby_pri ); |
$order_pri = _orderby_pri( $orderby_pri ); |
| 522 |
|
|
| 523 |
// Main data query |
// Main data query |
| 524 |
$query = "SELECT a.*, ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count, u.name AS author, u.usertype, 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, cc.name AS category, g.name AS groups, s.title AS section" |
| 525 |
. "\n FROM #__content AS a" |
. "\n FROM #__content AS a" |
| 526 |
. "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" |
. "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" |
| 527 |
. "\n LEFT JOIN #__users AS u ON u.id = a.created_by" |
. "\n LEFT JOIN #__users AS u ON u.id = a.created_by" |
| 537 |
$rows = $database->doSQLget($query, 'mosExtendedContent'); |
$rows = $database->doSQLget($query, 'mosExtendedContent'); |
| 538 |
|
|
| 539 |
// Dynamic Page Title |
// Dynamic Page Title |
| 540 |
if ($menu) { |
// do we have multiple sections? |
| 541 |
$mainframe->setPageTitle( $menu->name ); |
$multiple_sections = false; |
| 542 |
|
if (count($rows)) { |
| 543 |
|
$temp = array(); |
| 544 |
|
foreach($rows as $row) { |
| 545 |
|
$temp[$row->section] = ''; |
| 546 |
|
} |
| 547 |
|
if (count($temp) > 1) { |
| 548 |
|
$multiple_sections = true; |
| 549 |
|
} |
| 550 |
|
unset($temp); |
| 551 |
|
} |
| 552 |
|
if (!$pageTitle) { |
| 553 |
|
// set the page title |
| 554 |
|
if ($rows[0]->section && !$multiple_sections){ |
| 555 |
|
$pageTitle = $rows[0]->section; |
| 556 |
|
} else { |
| 557 |
|
$pageTitle = T_('Blog'); |
| 558 |
|
} |
| 559 |
|
// fudge the pathway |
| 560 |
|
$mainframe->appendPathway($pageTitle); |
| 561 |
|
} |
| 562 |
|
$mainframe->setPageTitle( $pageTitle ); |
| 563 |
|
|
| 564 |
|
// restore borrowed $row->section to null - IMPORTANT |
| 565 |
|
if (count($rows)) { |
| 566 |
|
for($i=0; $i<count($rows); $i++) $rows[$i]->section = ''; |
| 567 |
} |
} |
| 568 |
|
|
| 569 |
BlogOutput( $rows, $params, $gid, $access, $pop, $menu ); |
BlogOutput( $rows, $params, $gid, $access, $pop, $menu, null, $limit, $limitstart ); |
| 570 |
} |
} |
| 571 |
|
|
| 572 |
function showBlogCategory( $id=0, $gid, &$access, $pop, $now ) { |
function showBlogCategory( $id=0, $gid, &$access, $pop, $limit, $limitstart ) { |
| 573 |
global $database, $mainframe, $mosConfig_offset, $Itemid; |
global $database, $mainframe, $mosConfig_offset, $Itemid; |
| 574 |
|
|
| 575 |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
| 576 |
|
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
| 577 |
// Paramters |
// Paramters |
| 578 |
$params = new stdClass(); |
$params = new stdClass(); |
| 579 |
if ( $Itemid ) { |
if ( $Itemid ) { |
| 617 |
// Dynamic Page Title |
// Dynamic Page Title |
| 618 |
$mainframe->SetPageTitle( $menu->name ); |
$mainframe->SetPageTitle( $menu->name ); |
| 619 |
|
|
| 620 |
BlogOutput( $rows, $params, $gid, $access, $pop, $menu ); |
BlogOutput( $rows, $params, $gid, $access, $pop, $menu, null, $limit, $limitstart ); |
| 621 |
} |
} |
| 622 |
|
|
| 623 |
function showArchiveSection( $id=NULL, $gid, &$access, $pop, $option ) { |
function showArchiveSection( $id=NULL, $gid, &$access, $pop, $option ) { |
| 789 |
} |
} |
| 790 |
|
|
| 791 |
|
|
| 792 |
function BlogOutput ( &$rows, &$params, $gid, &$access, $pop, &$menu, $archive=NULL ) { |
function BlogOutput ( &$rows, &$params, $gid, &$access, $pop, &$menu, $archive=NULL, $limit = 0, $limitstart = 0 ) { |
| 793 |
global $mainframe, $Itemid, $task, $id, $option, $database, $mosConfig_live_site; |
global $mainframe, $Itemid, $task, $id, $option, $database, $mosConfig_live_site; |
| 794 |
|
|
| 795 |
// parameters |
// parameters |
| 820 |
$total = count( $rows ); |
$total = count( $rows ); |
| 821 |
|
|
| 822 |
// pagination support |
// pagination support |
| 823 |
|
if (!$limitstart){ |
| 824 |
$limitstart = intval( mosGetParam( $_REQUEST, 'limitstart', 0 ) ); |
$limitstart = intval( mosGetParam( $_REQUEST, 'limitstart', 0 ) ); |
| 825 |
|
} |
| 826 |
$limit = $intro + $leading + $links; |
$limit = $intro + $leading + $links; |
| 827 |
if ( $total <= $limit ) { |
if ( $total <= $limit ) { |
| 828 |
$limitstart = 0; |
$limitstart = 0; |
| 1036 |
; |
; |
| 1037 |
} |
} |
| 1038 |
|
|
|
// temporary workaround for special access - alwarren 20070207 |
|
| 1039 |
global $acl; |
global $acl; |
| 1040 |
$viewAccess = ($gid >= $acl->get_group_id( 'Registered', 'ARO' ) ? 1 : 0) + ($gid >= $acl->get_group_id( 'Author', 'ARO' ) ? 1 : 0); |
$viewAccess = ($gid >= $acl->get_group_id( 'Registered', 'ARO' ) ? 1 : 0) + ($gid >= $acl->get_group_id( 'Author', 'ARO' ) ? 1 : 0); |
|
// end special access workaraound |
|
| 1041 |
$query = "SELECT a.*, ROUND(v.rating_sum/v.rating_count) AS rating, v.rating_count, u.name AS author, u.usertype, cc.name AS category, s.name AS section, 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, cc.name AS category, s.name AS section, g.name AS groups" |
| 1042 |
. "\n FROM #__content AS a" |
. "\n FROM #__content AS a" |
| 1043 |
. "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" |
. "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" |
| 1046 |
. "\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" |
| 1047 |
. "\n LEFT JOIN #__groups AS g ON a.access = g.id" |
. "\n LEFT JOIN #__groups AS g ON a.access = g.id" |
| 1048 |
. "\n WHERE a.id='". $uid ."' ". $xwhere |
. "\n WHERE a.id='". $uid ."' ". $xwhere |
|
// temporary workaround for special access - alwarren 20070207 |
|
| 1049 |
. "\n AND a.access <= ". $viewAccess |
. "\n AND a.access <= ". $viewAccess |
|
// . "\n AND a.access <= ". $gid // original code |
|
|
// end special access workaraound |
|
| 1050 |
; |
; |
| 1051 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
|
// $row = NULL; |
|
| 1052 |
$row = new mosExtendedContent(); |
$row = new mosExtendedContent(); |
| 1053 |
|
|
| 1054 |
if ( $database->loadObject( $row ) ) { |
if ( $database->loadObject( $row ) ) { |
| 1111 |
function show( $row, $params, $gid, &$access, $pop, $option, $ItemidCount=NULL ) { |
function show( $row, $params, $gid, &$access, $pop, $option, $ItemidCount=NULL ) { |
| 1112 |
global $database, $mainframe, $Itemid; |
global $database, $mainframe, $Itemid; |
| 1113 |
global $mosConfig_live_site, $mosConfig_absolute_path; |
global $mosConfig_live_site, $mosConfig_absolute_path; |
| 1114 |
global $options, $cache; |
global $options, $task; |
| 1115 |
|
|
| 1116 |
|
$cache = mosCache::getCache('com_content','Output'); |
| 1117 |
|
|
| 1118 |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
$noauth = !$mainframe->getCfg( 'shownoauth' ); |
| 1119 |
|
|
| 1219 |
$obj = new mosContent( $database ); |
$obj = new mosContent( $database ); |
| 1220 |
$obj->hit( $row->id ); |
$obj->hit( $row->id ); |
| 1221 |
} |
} |
| 1222 |
|
if(!($cache->start($task.$row->id.$page,'com_content'))){ |
| 1223 |
$cache->call( 'HTML_content::show', $row, $params, $access, $page, $option, $ItemidCount ); |
HTML_content::show( $row, $params, $access, $page, $option, $ItemidCount ); |
| 1224 |
|
$cache->end(); |
| 1225 |
|
} |
| 1226 |
} |
} |
| 1227 |
|
|
| 1228 |
|
|
| 1340 |
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', $sectionid, intval( $row->catid ) ); |
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', $sectionid, intval( $row->catid ) ); |
| 1341 |
// build the select list for the image positions |
// build the select list for the image positions |
| 1342 |
$lists['_align'] = mosAdminMenus::Positions( '_align' ); |
$lists['_align'] = mosAdminMenus::Positions( '_align' ); |
| 1343 |
|
// build the select list for the image caption alignment |
| 1344 |
|
$lists['_caption_align'] = mosAdminMenus::Positions( '_caption_align' ); |
| 1345 |
// build the html select list for the group access |
// build the html select list for the group access |
| 1346 |
$lists['access'] = mosAdminMenus::Access( $row ); |
$lists['access'] = mosAdminMenus::Access( $row ); |
| 1347 |
|
|
| 1348 |
|
// build the select list for the image caption position |
| 1349 |
|
$pos[] = mosHTML::makeOption( 'bottom', _CMN_BOTTOM ); |
| 1350 |
|
$pos[] = mosHTML::makeOption( 'top', _CMN_TOP ); |
| 1351 |
|
$lists['_caption_position'] = mosHTML::selectList( $pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text' ); |
| 1352 |
|
|
| 1353 |
HTML_content::editContent( $row, $section, $lists, $images, $access, $my->id, $sectionid, $task, $Itemid ); |
HTML_content::editContent( $row, $section, $lists, $images, $access, $my->id, $sectionid, $task, $Itemid ); |
| 1354 |
} |
} |
| 1355 |
|
|
| 1520 |
$subject_default = sprintf(T_('Item sent by %s'), $yourname); |
$subject_default = sprintf(T_('Item sent by %s'), $yourname); |
| 1521 |
$subject = trim( mosGetParam( $_POST, 'subject', $subject_default ) ); |
$subject = trim( mosGetParam( $_POST, 'subject', $subject_default ) ); |
| 1522 |
|
|
| 1523 |
session_start(); |
mos_session_start(); |
| 1524 |
$form_check = mosGetParam( $_POST, 'form_check', '' ); |
$form_check = mosGetParam( $_POST, 'form_check', '' ); |
| 1525 |
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']) { |
| 1526 |
// the form hasn't been generated by the server on this session |
// the form hasn't been generated by the server on this session |
| 1556 |
} |
} |
| 1557 |
|
|
| 1558 |
function recordVote() { |
function recordVote() { |
| 1559 |
global $database; |
global $database, $mosConfig_live_site, $mosConfig_offset, $acl, $gid; |
| 1560 |
|
|
| 1561 |
$user_rating = mosGetParam( $_REQUEST, 'user_rating', 0 ); |
$user_rating = mosGetParam( $_REQUEST, 'user_rating', 0 ); |
|
$url = mosGetParam( $_REQUEST, 'url', '' ); |
|
| 1562 |
$cid = mosGetParam( $_REQUEST, 'cid', 0 ); |
$cid = mosGetParam( $_REQUEST, 'cid', 0 ); |
| 1563 |
$cid = intval( $cid ); |
$cid = intval( $cid ); |
| 1564 |
|
$Itemid = mosGetParam( $_REQUEST, 'Itemid', 0 ); |
| 1565 |
|
$Itemid = intval( $Itemid ); |
| 1566 |
$user_rating = intval( $user_rating ); |
$user_rating = intval( $user_rating ); |
| 1567 |
|
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
| 1568 |
|
$viewAccess = ($gid >= $acl->get_group_id( 'Registered', 'ARO' ) ? 1 : 0) + ($gid >= $acl->get_group_id( 'Author', 'ARO' ) ? 1 : 0); |
| 1569 |
|
|
| 1570 |
|
$url = sefReltoAbs("index.php?option=com_content&task=view&id={$cid}&Itemid={$Itemid}"); |
| 1571 |
if ( ( $user_rating >= 1 ) and ( $user_rating <= 5 ) ) { |
if ( ( $user_rating >= 1 ) and ( $user_rating <= 5 ) ) { |
| 1572 |
$currip = getenv( 'REMOTE_ADDR' ); |
$currip = getenv( 'REMOTE_ADDR' ); |
| 1573 |
|
|
| 1574 |
|
$query = "SELECT * FROM #__content as c WHERE id = $cid AND (c.state = '1' OR c.state = '-1')" |
| 1575 |
|
. "\n AND (c.publish_up = '0000-00-00 00:00:00' OR c.publish_up <= '$now')" |
| 1576 |
|
. "\n AND (c.publish_down = '0000-00-00 00:00:00' OR c.publish_down >= '$now')" |
| 1577 |
|
. "\n AND access <= ". $viewAccess; |
| 1578 |
|
; |
| 1579 |
|
$database->setQuery( $query ); |
| 1580 |
|
$database->loadObject( $row ); |
| 1581 |
|
if ( $row != NULL){ |
| 1582 |
$query = "SELECT * FROM #__content_rating WHERE content_id = $cid"; |
$query = "SELECT * FROM #__content_rating WHERE content_id = $cid"; |
| 1583 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 1584 |
$votesdb = NULL; |
$votesdb = NULL; |
| 1602 |
} |
} |
| 1603 |
} |
} |
| 1604 |
mosRedirect ( $url, T_('Thanks for your vote!') ); |
mosRedirect ( $url, T_('Thanks for your vote!') ); |
| 1605 |
|
} else { |
| 1606 |
|
mosRedirect ( $url, T_('The rating for this item is not allowed!') ); |
| 1607 |
|
} |
| 1608 |
} |
} |
| 1609 |
} |
} |
| 1610 |
|
|
| 1719 |
} |
} |
| 1720 |
|
|
| 1721 |
function sectionURL ($sectionid) { |
function sectionURL ($sectionid) { |
| 1722 |
global $Itemid; |
$menuHandler = mosMenuHandler::getInstance(); |
| 1723 |
|
$Itemid = $menuHandler->getSectionItemId($sectionid); |
| 1724 |
return "index.php?option=com_content&task=section&id=$sectionid&Itemid=$Itemid"; |
return "index.php?option=com_content&task=section&id=$sectionid&Itemid=$Itemid"; |
| 1725 |
} |
} |
| 1726 |
|
|
| 1727 |
function categoryURL ($sectionid, $catid) { |
function categoryURL ($sectionid, $catid) { |
| 1728 |
global $Itemid; |
$menuHandler = mosMenuHandler::getInstance(); |
| 1729 |
|
$Itemid = $menuHandler->getCategoryItemId($catid); |
| 1730 |
return "index.php?option=com_content&task=category§ionid=$sectionid&id=$catid&Itemid=$Itemid"; |
return "index.php?option=com_content&task=category§ionid=$sectionid&id=$catid&Itemid=$Itemid"; |
| 1731 |
} |
} |
| 1732 |
|
|