--- mambo/trunk/components/com_content/content.php 2005/12/13 03:45:47 1 +++ mambo/branches/4.6/components/com_content/content.php 2006/07/18 12:18:02 609 @@ -1,17 +1,20 @@ getPath( 'front_html', 'com_content' ) ); +require_once($mainframe->getPath('class')); $id = intval( mosGetParam( $_REQUEST, 'id', 0 ) ); $sectionid = intval( mosGetParam( $_REQUEST, 'sectionid', 0 ) ); @@ -166,8 +169,9 @@ . "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )" . "\n ORDER BY ". $order_pri . $order_sec ; - $database->setQuery( $query ); - $rows = $database->loadObjectList(); +// $database->setQuery( $query ); +// $rows = $database->loadObjectList(); + $rows = $database->doSQLget($query, 'mosExtendedContent'); // Dynamic Page Title $mainframe->SetPageTitle( $menu->name ); @@ -203,6 +207,8 @@ $params->def( 'empty_cat', 0 ); $params->def( 'cat_items', 1 ); $params->def( 'cat_description', 1 ); + $params->def( 'description', 1 ); + $params->def( 'description-image', 1 ); $params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); $params->def( 'pageclass_sfx', '' ); @@ -302,6 +308,8 @@ $params->def( 'empty_cat', 0 ); $params->def( 'cat_items', 1 ); $params->def( 'cat_description', 0 ); + $params->def( 'description', 1 ); + $params->def( 'description-image', 1 ); $params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); $params->def( 'pageclass_sfx', '' ); $params->def( 'headings', 1 ); @@ -319,6 +327,9 @@ $sectionid = $category->section; } + $pathway =& mosPathway::getInstance(); + $pathway->addItem($category->title, categoryURL($sectionid, $id)); + if ( $access->canEdit ) { $xwhere = ''; $xwhere2 = "\n AND b.state >= '0'"; @@ -360,20 +371,20 @@ // get the total number of published items in the category // filter functionality - $filter = trim( mosGetParam( $_POST, 'filter', '' ) ); - $filter = strtolower( $filter ); - $and = ''; - if ( $filter ) { + $_and = ''; + if ($filter = mosGetParam($_POST, 'filter', '')) { + $filter = strtolower( $filter ); + $filter = $database->getEscaped($filter); if ( $params->get( 'filter' ) ) { switch ( $params->get( 'filter_type' ) ) { case 'title': - $and = "\n AND LOWER( a.title ) LIKE '%". $filter ."%'"; + $_and = "\n AND LOWER( a.title ) LIKE '%". $filter ."%'"; break; case 'author': - $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 ."%' ) )"; break; case 'hits': - $and = "\n AND a.hits LIKE '%". $filter ."%'"; + $_and = "\n AND a.hits LIKE '%". $filter ."%'"; break; } } @@ -396,7 +407,7 @@ . "\n WHERE a.catid='". $category->id ."' ". $xwhere . ( $noauth ? "\n AND a.access<='". $gid ."'" : '' ) . "\n AND '". $category->access ."'<='". $gid ."'" - . $and + . $_and . "\n ORDER BY ". $orderby ."" ; $database->setQuery( $query ); @@ -416,7 +427,7 @@ . "\n WHERE a.catid='". $category->id ."' ". $xwhere . ( $noauth ? "\n AND a.access<='". $gid ."'" : '' ) . "\n AND '". $category->access ."'<='". $gid ."'" - . $and + . $_and . "\n ORDER BY ". $orderby ."" . "\n LIMIT ". $limitstart .", ". $limit ; @@ -425,26 +436,26 @@ $check = 0; if ( $params->get( 'date' ) ) { - $order[] = mosHTML::makeOption( 'date', _ORDER_DROPDOWN_DA ); - $order[] = mosHTML::makeOption( 'rdate', _ORDER_DROPDOWN_DD ); + $order[] = mosHTML::makeOption( 'date', T_('Date Asc') ); + $order[] = mosHTML::makeOption( 'rdate', T_('Date Desc')); $check .= 1; } if ( $params->get( 'title' ) ) { - $order[] = mosHTML::makeOption( 'alpha', _ORDER_DROPDOWN_TA ); - $order[] = mosHTML::makeOption( 'ralpha', _ORDER_DROPDOWN_TD ); + $order[] = mosHTML::makeOption( 'alpha', T_('Title Asc') ); + $order[] = mosHTML::makeOption( 'ralpha', T_('Title Desc') ); $check .= 1; } if ( $params->get( 'hits' ) ) { - $order[] = mosHTML::makeOption( 'hits', _ORDER_DROPDOWN_HA ); - $order[] = mosHTML::makeOption( 'rhits', _ORDER_DROPDOWN_HD ); + $order[] = mosHTML::makeOption( 'hits', T_('Hits Asc') ); + $order[] = mosHTML::makeOption( 'rhits', T_('Hits Desc') ); $check .= 1; } if ( $params->get( 'author' ) ) { - $order[] = mosHTML::makeOption( 'author', _ORDER_DROPDOWN_AUA ); - $order[] = mosHTML::makeOption( 'rauthor', _ORDER_DROPDOWN_AUD ); + $order[] = mosHTML::makeOption( 'author', T_('Author Asc') ); + $order[] = mosHTML::makeOption( 'rauthor', T_('Author Desc') ); $check .= 1; } - $order[] = mosHTML::makeOption( 'order', _ORDER_DROPDOWN_O ); + $order[] = mosHTML::makeOption( 'order', T_('Ordering') ); $lists['order'] = mosHTML::selectList( $order, 'order', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $selected ); if ( $check < 1 ) { $lists['order'] = ''; @@ -502,9 +513,10 @@ . "\n AND s.access<=$gid" . "\n ORDER BY ". $order_pri . $order_sec ; - $database->setQuery( $query ); - $rows = $database->loadObjectList(); - +// $database->setQuery( $query ); +// $rows = $database->loadObjectList(); + $rows = $database->doSQLget($query, 'mosExtendedContent'); + // Dynamic Page Title if ($menu) { $mainframe->setPageTitle( $menu->name ); @@ -554,8 +566,9 @@ . "\n AND s.access <= ". $gid . "\n ORDER BY ". $order_pri . $order_sec; ; - $database->setQuery( $query ); - $rows = $database->loadObjectList(); +// $database->setQuery( $query ); +// $rows = $database->loadObjectList(); + $rows = $database->doSQLget($query, 'mosExtendedContent'); // Dynamic Page Title $mainframe->SetPageTitle( $menu->name ); @@ -624,8 +637,9 @@ . "\n AND s.access <= ". $gid . "\n ORDER BY ". $order_pri . $order_sec ; - $database->setQuery( $query ); - $rows = $database->loadObjectList(); +// $database->setQuery( $query ); +// $rows = $database->loadObjectList(); + $rows = $database->doSQLget($query, 'mosExtendedContent'); // initiate form echo '
'; @@ -635,7 +649,7 @@ if ( !$archives ) { // if no archives for category, hides search and outputs empty message - echo '
'. _CATEGORY_ARCHIVE_EMPTY .'
'; + echo '
'. T_('There are currently no Archived Entries for this Category') .'
'; } else { BlogOutput( $rows, $params, $gid, $access, $pop, $menu, 1 ); } @@ -704,8 +718,9 @@ . "\n AND s.access <= ". $gid . "\n ORDER BY ". $order_sec ; - $database->setQuery( $query ); - $rows = $database->loadObjectList(); +// $database->setQuery( $query ); +// $rows = $database->loadObjectList(); + $rows = $database->doSQLget($query, 'mosExtendedContent'); // initiate form echo ''; @@ -715,7 +730,7 @@ if ( !$archives ) { // if no archives for category, hides search and outputs empty message - echo '
'. _CATEGORY_ARCHIVE_EMPTY .'
'; + echo '
'. T_('There are currently no Archived Entries for this Category') .'
'; } else { BlogOutput( $rows, $params, $gid, $access, $pop, $menu, 1 ); } @@ -767,9 +782,11 @@ $i = $limitstart; // needed to reduce queries used by getItemid - $ItemidCount['bs'] = $mainframe->getBlogSectionCount(); - $ItemidCount['bc'] = $mainframe->getBlogCategoryCount(); - $ItemidCount['gbs'] = $mainframe->getGlobalBlogSectionCount(); + require_once(mamboCore::get('mosConfig_absolute_path').'/components/com_content/content.class.php'); + $handler =& new contentHandler(); + $ItemidCount['bs'] = $handler->getBlogSectionCount(); + $ItemidCount['bc'] = $handler->getBlogCategoryCount(); + $ItemidCount['gbs'] = $handler->getGlobalBlogSectionCount(); // used to display section/catagory description text and images // currently not supported in Archives @@ -811,7 +828,7 @@ if ( $archive ) { // Search Success message - $msg = sprintf( _ARCHIVE_SEARCH_SUCCESS, $params->get( 'month' ), $params->get( 'year' ) ); + $msg = sprintf( T_('Here are the Archived entries for %s %s'), $params->get( 'month' ), $params->get( 'year' ) ); echo "

". $msg ."


"; } echo ''; @@ -945,11 +962,11 @@ } else if ( $archive && !$total ) { // Search Failure message for Archives - $msg = sprintf( _ARCHIVE_SEARCH_FAILURE, $params->get( 'month' ), $params->get( 'year' ) ); + $msg = sprintf( T_('There are no Archived entries for %s %s'), $params->get( 'month' ), $params->get( 'year' ) ); echo '

'. $msg .'

'; } else { // Generic blog empty display - echo _EMPTY_BLOG; + echo T_('There are no items to display'); } // Back Button @@ -982,9 +999,13 @@ . "\n AND a.access <= ". $gid ; $database->setQuery( $query ); - $row = NULL; +// $row = NULL; + $row = new mosExtendedContent(); if ( $database->loadObject( $row ) ) { + $pathway =& mosPathway::getInstance(); + $pathway->addItem($row->category, categoryURL($row->sectionid, $row->catid)); + $pathway->addItem($row->title, ''); $params =& new mosParameters( $row->attribs ); $params->set( 'intro_only', 0 ); $params->def( 'back_button', $mainframe->getCfg( 'back_button' ) ); @@ -1149,7 +1170,7 @@ // fail if checked out not by 'me' if ( $row->checked_out && $row->checked_out <> $my->id ) { - echo""; + echo""; exit; } @@ -1222,13 +1243,13 @@ $row->frontpage = 0; } - // calls function to read image from directory $pathA = $mosConfig_absolute_path .'/images/stories'; $pathL = $mosConfig_live_site .'/images/stories'; $images = array(); $folders = array(); $folders[] = mosHTML::makeOption( '/' ); + require_once($mosConfig_absolute_path.'/administrator/includes/mosAdminMenus.php'); mosAdminMenus::ReadImages( $pathA, '/', $folders, $images ); // list of folders in images/stories/ $lists['folders'] = mosAdminMenus::GetImageFolders( $folders, $pathL ); @@ -1238,9 +1259,9 @@ $lists['imagelist'] = mosAdminMenus::GetSavedImages( $row, $pathL ); // make the select list for the states - $states[] = mosHTML::makeOption( 0, _CMN_UNPUBLISHED ); - $states[] = mosHTML::makeOption( 1, _CMN_PUBLISHED ); - $lists['state'] = mosHTML::selectList( $states, 'state', 'class="inputbox" size="1"', 'value', 'text', intval( $row->state ) ); + $states[] = mosHTML::makeOption( 0, T_('Unpublished') ); + $states[] = mosHTML::makeOption( 1, T_('Published') ); + $lists['state'] = mosHTML::selectList( $states, 'state', 'class="inputbox" size="1"', 'value', 'text', intval( $row->state ) ); // build the html select list for ordering $query = "SELECT ordering AS value, title AS text" @@ -1249,7 +1270,6 @@ . "\n ORDER BY ordering" ; $lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $uid, $query, 1 ); - // build list of categories $lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', $sectionid, intval( $row->catid ) ); // build the select list for the image positions @@ -1355,12 +1375,12 @@ $users = $database->loadResultArray(); foreach ($users as $user_id) { $msg = new mosMessage( $database ); - $msg->send( $my->id, $user_id, "New Item", sprintf( _ON_NEW_CONTENT, $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 ) ); } } $Itemid = mosGetParam( $_POST, 'Returnid', '0' ); - $msg = $isNew ? _THANK_SUB : _E_ITEM_SAVED; + $msg = $isNew ? T_('Thanks for your submission; it will be reviewed before being posted to the site.') : T_('Item saved successfully.'); mosRedirect( 'index.php', $msg ); } @@ -1380,12 +1400,8 @@ } $Itemid = mosGetParam( $_POST, 'Returnid', '0' ); - - if ( $Itemid ) { - mosRedirect( 'index.php?option=com_content&task=view&id='. $row->id .'&Itemid='. $Itemid ); - } else { - mosRedirect( 'index.php' ); - } + + mosRedirect( 'index.php' ); } /** @@ -1393,7 +1409,6 @@ */ function emailContentForm( $uid ) { global $database, $mainframe, $my; - $row = new mosContent( $database ); $row->load( $uid ); @@ -1404,7 +1419,7 @@ $template=''; $database->setQuery( "SELECT template FROM #__templates_menu WHERE client_id = '0' AND menuid = '0'" ); $template = $database->loadResult(); - HTML_content::emailForm( $row->id, $row->title, $template ); + HTML_content::emailForm( $row->id, $row->title, $template ); } } @@ -1423,18 +1438,16 @@ $email = trim( mosGetParam( $_POST, 'email', '' ) ); $yourname = trim( mosGetParam( $_POST, 'yourname', '' ) ); $youremail = trim( mosGetParam( $_POST, 'youremail', '' ) ); - $subject_default = _EMAIL_INFO ." $yourname"; + $subject_default = sprintf(T_('Item sent by %s'), $yourname); $subject = trim( mosGetParam( $_POST, 'subject', $subject_default ) ); - - + $form_check = mosGetParam( $_POST, 'form_check', '' ); if (empty($_SESSION['_form_check_']['com_content']) || $form_check != $_SESSION['_form_check_']['com_content']) { // the form hasn't been generated by the server on this session exit; - } - + } if ( !$email || !$youremail || ( is_email( $email ) == false ) || ( is_email( $youremail ) == false ) ) { - echo ""; + echo ""; exit(0); } @@ -1444,9 +1457,11 @@ // link sent in email $link = sefRelToAbs( $mosConfig_live_site .'/index.php?option=com_content&task=view&id='. $uid .'&Itemid='. $_Itemid ); - // message text - $msg = sprintf( _EMAIL_MSG, $mosConfig_sitename, $yourname, $youremail, $link ); + $msg = sprintf( T_(' The following page from the "%s" website has been sent to you by %s ( %s ). + +You can access it at the following url: +%s'), $mosConfig_sitename, $yourname, $youremail, $link ); // mail function mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $email, $subject, $msg ); @@ -1494,10 +1509,10 @@ $database->setQuery( $query ); $database->query() or die( $database->stderr() ); } else { - mosRedirect ( $url, _ALREADY_VOTE ); + mosRedirect ( $url, T_('You already voted for this poll today!') ); } } - mosRedirect ( $url, _THANKS ); + mosRedirect ( $url, T_('Thanks for your vote!') ); } } @@ -1610,4 +1625,15 @@ return $where; } + +function sectionURL ($sectionid) { + global $Itemid; + return "index.php?option=com_content&task=section&id=$sectionid&Itemid=$Itemid"; +} + +function categoryURL ($sectionid, $catid) { + global $Itemid; + return "index.php?option=com_content&task=category§ionid=$sectionid&id=$catid&Itemid=$Itemid"; +} + ?>