From 382f2f9a5025adc22d9dd8881d77d4a39f41bbb3 Mon Sep 17 00:00:00 2001 From: Miriam Ruiz Date: Sat, 29 May 2010 02:45:26 +0200 Subject: [PATCH] Replaced FeedPublisher by FeedThis: feedthis-1.03.zip http://vanillaforums.org/addon/419/feedthis MD5=ba0c852504349e01aeb92ec5e50db8bb SHA1=4c71721e8841355ab72837c43d494ceccd0b50b3 SHA256=e2f98e2143ff411318e02f37cfec66bf7b8dbd5e5b148b4b52c2178a6aaa3b80 --- extensions/FeedPublisher/categories_config.php | 72 --- extensions/FeedPublisher/changelog.txt | 53 -- extensions/FeedPublisher/config.php | 51 -- extensions/FeedPublisher/default.php | 486 ----------------- extensions/FeedPublisher/functions.php | 331 ------------ extensions/FeedPublisher/global_functions.php | 81 --- extensions/FeedPublisher/readme.txt | 63 --- .../FeedPublisher/translations/Castellano.php | 16 - extensions/FeedPublisher/translations/french.php | 16 - extensions/FeedPublisher/translations/readme.txt | 4 - extensions/FeedThis/default.php | 273 ++++++++++ extensions/FeedThis/feedthis.png | Bin 0 -> 5541 bytes extensions/FeedThis/finetune.php | 53 ++ extensions/FeedThis/languages/english.php | 31 ++ extensions/FeedThis/library/Function.FeedThis.php | 582 +++++++++++++++++++++ .../FeedThis/library/PostBackControl.FeedThis.php | 65 +++ extensions/FeedThis/readme.html | 42 ++ extensions/FeedThis/theme/Theme.FeedThisForm.php | 68 +++ 18 files changed, 1114 insertions(+), 1173 deletions(-) delete mode 100755 extensions/FeedPublisher/categories_config.php delete mode 100755 extensions/FeedPublisher/changelog.txt delete mode 100755 extensions/FeedPublisher/config.php delete mode 100755 extensions/FeedPublisher/default.php delete mode 100755 extensions/FeedPublisher/functions.php delete mode 100755 extensions/FeedPublisher/global_functions.php delete mode 100755 extensions/FeedPublisher/readme.txt delete mode 100755 extensions/FeedPublisher/translations/Castellano.php delete mode 100755 extensions/FeedPublisher/translations/french.php delete mode 100755 extensions/FeedPublisher/translations/readme.txt create mode 100755 extensions/FeedThis/default.php create mode 100644 extensions/FeedThis/feedthis.png create mode 100755 extensions/FeedThis/finetune.php create mode 100755 extensions/FeedThis/languages/english.php create mode 100644 extensions/FeedThis/library/Function.FeedThis.php create mode 100644 extensions/FeedThis/library/PostBackControl.FeedThis.php create mode 100644 extensions/FeedThis/readme.html create mode 100644 extensions/FeedThis/theme/Theme.FeedThisForm.php diff --git a/extensions/FeedPublisher/categories_config.php b/extensions/FeedPublisher/categories_config.php deleted file mode 100755 index 3f71e55..0000000 --- a/extensions/FeedPublisher/categories_config.php +++ /dev/null @@ -1,72 +0,0 @@ -AddString) - * - and the auto-discovery feed link tag ($Panel->AddString)) - * with the appropriate url for your categories. - * - * To determine the proper url for each category, perform an "advanced" - * search for comments in a particular category -- without keywords -- - * and copy & paste the resulting url (after adding '&Feed=the_feed_type' - * to it, where the_feed_type is RSS2, ATOM...) - * in the config section below (or to your feedburner account). - * - * NOTE: Links (panel and head) to a feed is automatically set for every - * discussion and for any search in Topics or in Comments, - * so this section only deals with index.php pages. - */ - -// manual placement for the "all discussions" feed links -if ( 0 == ForceIncomingInt( 'CategoryID', 0 ) ) -{ - $content = ' - '; - // add link to the panel - $Panel->AddString( $content, 10 ); - - // add auto-discovery link to head - $Head->AddString( '' ); - $Head->AddString( '' ); -} - -// manual placement for an example category named "general" (RSS2) -// this example category has a categoryid == 1 -if ( 1 == ForceIncomingInt( 'CategoryID', 0 ) ) -{ - $content = ' - '; - $Panel->AddString( $content, 10 ); - - // add auto-discovery link to head - $Head->AddString( '' ); - $Head->AddString( '' ); -} diff --git a/extensions/FeedPublisher/changelog.txt b/extensions/FeedPublisher/changelog.txt deleted file mode 100755 index 3617d60..0000000 --- a/extensions/FeedPublisher/changelog.txt +++ /dev/null @@ -1,53 +0,0 @@ -Feed Publisher - -http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=304 - -a Vanilla extension, see http://lussumo.com/addons - -CHANGELOG: - -0.3.2 08/08/10 - -Fixed add-on name to make the updater work (thanks to elm). - -0.3.1 07/11/29 - -Fixed display bug: http://lussumo.com/community/?CommentID=78539 - -0.3.0 07/10/31 - -Added a config option to prevent FP to stop the execution of Vanilla. -This allows us to use the SimpleCache add-on. -If ExitAfterFeed is set to false, some useless processing is done, though. - -0.2.0 07/07/10 - -xml-stylesheet tag added to the feeds according to config settings -xml declaration for RSS2 feeds was missing, now fixed - -0.1.0 07/07/03 - -feed item description now formatted according to the relevant formatter -css classes for feed links (uppercase: RSS2 & ATOM) - -0.0.3 07/06/24 - -fixed the deprecated Call-time pass-by-reference issue - -0.0.2 07/06/23 - -total internationalization -new flow, -ATOM integration: - renaming 'rss' functions - - pass the $FeedType parameter -for the ATOM feed extension (Mark) see -http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=3 -categories configuration more simple and in an other file - -0.0.1 07/06/15 - -changed header credits on default.php, readme.txt -refactored comments and coding style, -source code and code comments are THE SAME as -the CrudeRSS extension (a bit of renaming though). -Path announced in readme.txt fixed. diff --git a/extensions/FeedPublisher/config.php b/extensions/FeedPublisher/config.php deleted file mode 100755 index e6c8682..0000000 --- a/extensions/FeedPublisher/config.php +++ /dev/null @@ -1,51 +0,0 @@ -' ][] for - * use of several style sheets. - */ -$fp_conf[ 'StyleSheet_RSS2' ][] = array(); -$fp_conf[ 'StyleSheet_ATOM' ][] = array(); -/* some examples - -// to add < ?xml-stylesheet href="/rss.css" type="text/css"? >, use -$fp_conf[ 'StyleSheet_RSS2' ][] = array( - 'href' => '/rss.css', - 'type' => 'text/css' ); - -// to add -// < ?xml-stylesheet type="text/xsl" href="style.xsl" media="screen"? > -// < ?xml-stylesheet href="http://www.site.com/atom.css" type="text/css"? >, use -$fp_conf[ 'StyleSheet_ATOM' ][] = array( - 'type' => 'text/xsl', - 'href' => 'style.xsl', - 'media'=> 'screen' ); -$fp_conf[ 'StyleSheet_ATOM' ][] = array( - 'href' => 'http://www.site.com/atom.css', - 'type' => 'text/css' ); -*/ diff --git a/extensions/FeedPublisher/default.php b/extensions/FeedPublisher/default.php deleted file mode 100755 index 1074743..0000000 --- a/extensions/FeedPublisher/default.php +++ /dev/null @@ -1,486 +0,0 @@ -SetDefinition( - "Feeds", - "Feeds"); - $Context->SetDefinition( - "FP_feedLinkToolTip_discussion", - "Subscribe to the feed of this discussion"); - $Context->SetDefinition( - "FP_feedLinkToolTip_search", - "Subscribe to the feed of this search"); - $Context->SetDefinition( - "RSS2Feed", - "RSS2"); - $Context->SetDefinition( - "ATOMFeed", - "ATOM"); - $Context->SetDefinition( - "FailedFeedAuthenticationTitle", - "Failed Authentication"); - $Context->SetDefinition( - "FailedFeedAuthenticationText", - "Feeds for this forum require user authentication."); - // end language strings - -///// now the code... -//////////////////////// - - // grab the config items - include( $Configuration[ 'EXTENSIONS_PATH' ] . 'FeedPublisher/config.php' ); - // incorporate them in the Vanilla ones with our 'fp_' namespace - if ( is_array( $fp_conf ) AND !empty( $fp_conf ) ) - { - foreach( $fp_conf as $k => $v ) - $Context->Configuration[ 'fp_'.$k ] = $v; - } - unset( $fp_conf ); - - // this will tell us if we browse the forum or if a feed has to be rendered - // ( $FeedType == '' ) means normal browsing - $FeedType = ForceIncomingString( 'Feed', '' ); - - // sanitize the feed type: only let the published ones through - if ( ! in_array( $FeedType, $Context->Configuration[ 'fp_PublishedTypes' ] ) ) - $FeedType = ''; - - // only process Feed Publisher on some pages and if the feed type is correct - // quick note: list of php files in Vanilla root is - // account.php categories.php comments.php extension.php index.php - // people.php post.php search.php settings.php termsofservice.php - $processed_pages = array( 'index.php', 'search.php', 'comments.php' ); - $GoodPage = in_array( $Context->SelfUrl, $processed_pages ); - $GoodFeedType = ( - in_array( $FeedType, $Context->Configuration[ 'fp_PublishedTypes' ] ) - OR $FeedType == '' ); - if ( $GoodPage AND $GoodFeedType ) - { - // first some common stuff, then we'll act according to the requested page - if ( $FeedType == '' ) - { - include( $Configuration[ 'EXTENSIONS_PATH' ] . 'FeedPublisher/global_functions.php' ); - } - else - { - include( $Configuration[ "EXTENSIONS_PATH" ] . "FeedPublisher/functions.php" ); - - // Make sure that page is not redirected if the user is not signed in - // and this is not a public forum - if ( - $Context->Session->UserID == 0 - && ! $Configuration[ "PUBLIC_BROWSING" ] - ) - { - // Temporarily make the PUBLIC_BROWSING enabled, - // but make sure to validate this user - $Configuration[ "PUBLIC_BROWSING" ] = 1; - $Context->Configuration[ 'AUTHENTICATE_USER_FOR_FEED_PUBLISHER' ] = 1; - } - else - { - $Context->Configuration[ 'AUTHENTICATE_USER_FOR_FEED_PUBLISHER' ] = 0; - } - - // if we don't want to exit after the display of the feed, - // we display it after cleaning the buffer, after PageEnd's Render - if ( ! $Context->Configuration[ 'fp_ExitAfterFeed' ] ) - { - $Context->AddToDelegate( - 'PageEnd', - 'PostRender', - 'CleanBufferAndDisplayFeed' ); - } - } - - // act here according to the requested page - if ( $Context->SelfUrl == "index.php" ) - { - // see if we browse the forum or if a feed must be rendered - // ( $FeedType == '' ) means normal browsing - if ( $FeedType == '' ) - { - // include user configuration about categories, that's all - $cat_conf = 'FeedPublisher/categories_config.php'; - include( $Configuration[ 'EXTENSIONS_PATH' ] . $cat_conf ); - } - else - { - // REMOVED DUE TO PROBLEMS - // Use manual generic search feed without keywords instead. - } - } - elseif ( $Context->SelfUrl == "search.php" ) - { - // grab the search params in the url - $SearchType = ForceIncomingString( "Type", "" ); - $SearchID = ForceIncomingInt( "SearchID", 0); - - // if no search type in the url but we found an 'id' - // grab the search type from the 'id' - if ( $SearchType == "" && $SearchID > 0 ) - { - $SearchManager - = $Context->ObjectFactory->NewContextObject( $Context, "SearchManager" ); - $Search = $SearchManager->GetSearchById( $SearchID ); - if ( $Search ) $SearchType = $Search->Type; - } - - // now see if we browse the forum or if a feed must be rendered - // ( $FeedType == '' ) means normal browsing - if ( $FeedType == '' ) - { - // add feed links in the Vanilla panel and in the html head - // no links are set for User searches - if ( $SearchType == 'Topics' || $SearchType == 'Comments' ) - { - foreach ( $Context->Configuration[ 'fp_PublishedTypes' ] as $PublishedType ) - { - $LinksProperties[ 'FeedType' ] = $PublishedType ; - $LinksProperties[ 'PageType' ] = 'search'; - AddLinks( $Context, $Head, $Panel, $LinksProperties ); - } - } - } - else - { - if ( $SearchType == "Topics" ) - { - // Make sure that the first comment is also grabbed from the search - $Context->AddToDelegate( - "DiscussionManager", - "PostGetDiscussionBuilder", - "DiscussionManager_GetFirstCommentForFeeds" ); - - // Attach to the PostLoadData Delegate of the SearchForm control - function SearchForm_InjectFeedToTopicSearch( $SearchForm ) - { - global $FeedType; - - if ( $SearchForm->Context->WarningCollector->Count() == 0 ) - { - AuthenticateUserForFP( $SearchForm->Context ); - - // Make sure that some channel properties are defined - $SearchForm->Context->PageTitle - = ForceIncomingString( "Categories", "" ); - $SearchForm->Context->GetKeywords - = ForceIncomingString( "Keywords", "" ); - $SearchForm->Context->GetAuthUserName - = ForceIncomingString( "AuthUsername", "" ); - - // Loop through the data - $Counter = 0; - $Feed = ""; - $Properties = array(); - while ( $DataSet = $SearchForm->Context->Database->GetRow( $SearchForm->Data ) ) - { - if ( $Counter < $SearchForm->Context->Configuration[ "SEARCH_RESULTS_PER_PAGE" ] ) - { - $Properties[ "Title" ] - = FormatHtmlStringInline( ForceString( $DataSet[ "Name" ], "" ) ); - $Properties[ "Link" ] - = GetUrl( - $SearchForm->Context->Configuration, - "comments.php", - "", - "DiscussionID", - ForceInt( $DataSet[ "DiscussionID" ], 0 ) ); - $Properties[ "Published" ] - = FixDateForFP( $FeedType, @$DataSet[ "DateCreated" ] ); - $Properties[ "Updated" ] - = FixDateForFP( $FeedType, @$DataSet[ "DateLastActive" ]); - $Properties[ "AuthorName" ] - = FormatHtmlStringInline( - ForceString($DataSet[ "AuthUsername" ], "")); - $Properties[ "AuthorUrl" ] - = GetUrl( - $SearchForm->Context->Configuration, - "account.php", - "", - "u", - ForceInt($DataSet[ "AuthUserID" ], - 0)); - - // Format the comment according to the defined - // formatter for that comment - $FormatType - = ForceString( - @$DataSet[ "FormatType" ], - $SearchForm->Context->Configuration[ "DEFAULT_FORMAT_TYPE" ] ); - $FirstCommentBody - = ForceString( - @$DataSet[ "Body" ], '...' ); - $Properties[ "Content" ] - = $SearchForm->Context->FormatString( - $FirstCommentBody, - $SearchForm, - $FormatType, - FORMAT_STRING_FOR_DISPLAY); - $Properties[ "Summary" ] - = FormatStringForFeedSummary( @$DataSet[ "Body" ], $FeedType); - - $Feed .= ReturnFeedItem( $Properties, $FeedType ); - } - $Counter++; - } - - $Feed = ReturnWrappedFeedForSearch( $SearchForm->Context, $Feed, $FeedType ); - - if ( $SearchForm->Context->Configuration[ 'fp_ExitAfterFeed' ] ) - { - // Set the content type to xml and dump the feed - header("Content-type: text/xml\n"); - echo( $Feed ); - - // When all finished, unload the context object and stop - $SearchForm->Context->Unload(); - exit; - } - else - { - // store the feed in the context object - $SearchForm->Context->Feed = $Feed; - } - } - } - - $Context->AddToDelegate( - "SearchForm", - "PostLoadData", - "SearchForm_InjectFeedToTopicSearch" ); - } - elseif ( $SearchType == "Comments" ) - { - // Attach to the PostLoadData Delegate of the SearchForm control - function SearchForm_InjectFeedToCommentSearch( $SearchForm ) - { - global $FeedType; - - if ($SearchForm->Context->WarningCollector->Count() == 0) - { - AuthenticateUserForFP( $SearchForm->Context ); - - // Make sure that some channel properties are defined - $SearchForm->Context->PageTitle - = ForceIncomingString( "Categories", "" ); - $SearchForm->Context->GetKeywords - = ForceIncomingString( "Keywords", "" ); - $SearchForm->Context->GetAuthUserName - = ForceIncomingString( "AuthUsername", "" ); - - // Loop through the data - $Counter = 0; - $Feed = ""; - $Properties = array(); - $Comment = $SearchForm->Context->ObjectFactory->NewContextObject( $SearchForm->Context, "Comment" ); - while ( $Row = $SearchForm->Context->Database->GetRow( $SearchForm->Data ) ) - { - $Comment->Clear(); - $Comment->GetPropertiesFromDataSet( $Row, $SearchForm->Context->Session->UserID ); - - if ( $Counter < $SearchForm->Context->Configuration["SEARCH_RESULTS_PER_PAGE" ] ) - { - $Properties[ "Title" ] - = FormatHtmlStringInline( ForceString( $Comment->Discussion, "" ) ); - $Properties[ "Link" ] - = GetUrl( - $SearchForm->Context->Configuration, - "comments.php", - "", - "DiscussionID", - $Comment->DiscussionID, - "", - "Focus=" . $Comment->CommentID - ."#Comment_" . $Comment->CommentID ); - $Properties[ "Published" ] - = FixDateForFP( $FeedType, @$Row[ "DateCreated" ] ); - $Properties[ "Updated" ] - = FixDateForFP( $FeedType, @$Row[ "DateEdited" ] ); - $Properties[ "AuthorName" ] - = $Comment->AuthUsername; - $Properties[ "AuthorUrl" ] - = GetUrl( - $SearchForm->Context->Configuration, - "account.php", - "", - "u", - $Comment->AuthUserID ); - - // Format the comment according to the defined - // formatter for that comment - $Properties[ "Content" ] - = $SearchForm->Context->FormatString( - $Comment->Body, - $Comment, - $Comment->FormatType, - FORMAT_STRING_FOR_DISPLAY); - $Properties[ "Summary" ] - = FormatStringForFeedSummary( @$Row[ "Body" ], $FeedType ); - - $Feed .= ReturnFeedItem( $Properties, $FeedType ); - } - $Counter++; - } - - $Feed = ReturnWrappedFeedForSearch( $SearchForm->Context, $Feed, $FeedType ); - - if ( $SearchForm->Context->Configuration[ 'fp_ExitAfterFeed' ] ) - { - // Set the content type to xml and dump the feed - header("Content-type: text/xml\n"); - echo( $Feed ); - - // When all finished, unload the context object and stop - $SearchForm->Context->Unload(); - exit; - } - else - { - // store the feed in the context object - $SearchForm->Context->Feed = $Feed; - } - } - } - - $Context->AddToDelegate( - "SearchForm", - "PostLoadData", - "SearchForm_InjectFeedToCommentSearch"); - } - } - } - elseif ( $Context->SelfUrl == "comments.php" ) - { - // see if we browse the forum or if a feed must be rendered - // ( $FeedType == '' ) means normal browsing - if ( $FeedType == '' ) - { - // add feed links in the Vanilla panel and in the html head - foreach ( $Context->Configuration[ 'fp_PublishedTypes' ] as $PublishedType ) - { - $LinksProperties[ 'FeedType' ] = $PublishedType ; - $LinksProperties[ 'PageType' ] = 'discussion'; - AddLinks( $Context, $Head, $Panel, $LinksProperties ); - } - } - else - { - // Attach to the Constructor Delegate of the CommentGrid control - function CommentGrid_InjectFeed( $CommentGrid ) - { - global $FeedType; - - if ( $CommentGrid->Context->WarningCollector->Count() == 0 ) - { - AuthenticateUserForFP( $CommentGrid->Context ); - - // Make sure that some channel properties are defined - $CommentGrid->Context->PageTitle - = $CommentGrid->Discussion->Name; - - // Loop through the data - $Feed = ""; - $Properties = array(); - $PageCount - = CalculateNumberOfPages( - $CommentGrid->CommentDataCount, - $CommentGrid->Context->Configuration[ 'COMMENTS_PER_PAGE' ] ); - $CommentManager - = $CommentGrid->Context->ObjectFactory->NewContextObject( - $CommentGrid->Context, - 'CommentManager' ); - $CurrentPage = 1; - while ( $CurrentPage <= $PageCount ) - { - $CommentGrid->CommentData = $CommentManager->GetCommentList( - $CommentGrid->Context->Configuration[ 'COMMENTS_PER_PAGE' ], - $CurrentPage, - $CommentGrid->Discussion->DiscussionID ); - $Comment - = $CommentGrid->Context->ObjectFactory->NewContextObject( - $CommentGrid->Context, - "Comment" ); - while ( $Row = $CommentGrid->Context->Database->GetRow( $CommentGrid->CommentData ) ) - { - $Comment->Clear(); - $Comment->GetPropertiesFromDataSet( $Row, $CommentGrid->Context->Session->UserID ); - - $Properties[ "Title" ] - = FormatHtmlStringInline( ForceString( $CommentGrid->Discussion->Name, "" ) ); - $Properties[ "Link" ] - = GetUrl( - $CommentGrid->Context->Configuration, - "comments.php", - "", - "DiscussionID", - $Comment->DiscussionID, - "", - "Focus=" . $Comment->CommentID - ."#Comment_" . $Comment->CommentID ); - $Properties[ "Published" ] - = FixDateForFP( $FeedType, @$Row[ "DateCreated" ] ); - $Properties[ "Updated" ] - = FixDateForFP( $FeedType, @$Row[ "DateEdited" ] ); - $Properties[ "AuthorName" ] - = $Comment->AuthUsername; - $Properties[ "AuthorUrl" ] - = GetUrl( - $CommentGrid->Context->Configuration, - "account.php", - "", - "u", - $Comment->AuthUserID ); - - // Format the comment according to the defined - // formatter for that comment - $Properties[ "Content" ] - = $CommentGrid->Context->FormatString( - $Comment->Body, - $Comment, - $Comment->FormatType, - FORMAT_STRING_FOR_DISPLAY); - $Properties[ "Summary" ] - = FormatStringForFeedSummary( @$Row[ "Body" ] ); - - $Feed .= ReturnFeedItem( $Properties, $FeedType ); - } - $CurrentPage++; - } - - $Feed = ReturnWrappedFeed( $CommentGrid->Context, $Feed, $FeedType ); - - if ( $CommentGrid->Context->Configuration[ 'fp_ExitAfterFeed' ] ) - { - // Set the content type to xml and dump the feed - header("Content-type: text/xml\n"); - echo( $Feed ); - - // When all finished, unload the context object and stop - $CommentGrid->Context->Unload(); - exit; - } - else - { - // store the feed in the context object - $CommentGrid->Context->Feed = $Feed; - } - } - } - - $Context->AddToDelegate( - "CommentGrid", - "Constructor", - "CommentGrid_InjectFeed" ); - } - } - } diff --git a/extensions/FeedPublisher/functions.php b/extensions/FeedPublisher/functions.php deleted file mode 100755 index d15f19a..0000000 --- a/extensions/FeedPublisher/functions.php +++ /dev/null @@ -1,331 +0,0 @@ -Configuration[ 'AUTHENTICATE_USER_FOR_FEED_PUBLISHER' ] ) - { - // Assume user is not authenticated. - $UserIsAuthenticated = false; - $PHP_AUTH_USER = ForceString( @$_SERVER['PHP_AUTH_USER'], '' ); - $PHP_AUTH_PW = ForceString( @$_SERVER['PHP_AUTH_PW'], '' ); - - if ( $PHP_AUTH_USER != '' && $PHP_AUTH_PW != '' ) - { - // Validate the inputs. - $s = $Context->ObjectFactory->NewContextObject( $Context, 'SqlBuilder' ); - $s->SetMainTable( 'User', 'u' ); - $s->AddSelect( 'UserID', 'u' ); - $s->AddWhere( 'u', 'Name', '', FormatStringForDatabaseInput( $PHP_AUTH_USER ), '=' ); - $s->StartWhereGroup(); - $s->AddWhere( 'u', 'Password', '', FormatStringForDatabaseInput( $PHP_AUTH_PW ), '=', 'and', 'md5' ); - $s->AddWhere( 'u', 'Password', '', FormatStringForDatabaseInput( $PHP_AUTH_PW ), '=', 'or' ); - $s->EndWhereGroup(); - - $ValidationData = $Context->Database->Select( $s, 'Feed', 'ValidateCredentials', 'An error occurred while validating user credentials.' ); - if ( $Context->Database->RowCount( $ValidationData) > 0 ) $UserIsAuthenticated = true; - } - - if ( ! $UserIsAuthenticated) { - header( 'WWW-Authenticate: Basic realm="Private"' ); - header( 'HTTP/1.0 401 Unauthorized'); - - echo( - '

' - .$Context->GetDefinition( 'FailedFeedAuthenticationTitle' ) - .'

-

' - .$Context->GetDefinition( 'FailedFeedAuthenticationText' ) - .'

' ); - $Context->Unload(); - die(); - } - } -} - -/** - * CleanBufferAndDisplayFeed - * - */ - -function CleanBufferAndDisplayFeed( $PageEnd ) -{ - ob_end_clean(); - ob_start(); - header("Content-type: text/xml\n"); - if ( ! empty( $PageEnd->Context->Feed )) - { - echo $PageEnd->Context->Feed; - } -} - -/** - * DiscussionManager_GetFirstCommentForFeeds - * - * Attach to the DiscussionManager's GetDiscussionBuilder method - * to ensure that the first comment is returned as well. - */ -function DiscussionManager_GetFirstCommentForFeeds( $DiscussionManager ) -{ - // SqlBuilder is passed by reference. - $SqlBuilder = &$DiscussionManager->DelegateParameters[ 'SqlBuilder' ]; - $SqlBuilder->AddJoin( - 'Comment', 'fc', 'CommentID', 't', 'FirstCommentID', 'left join' ); - $SqlBuilder->AddSelect( array('FormatType', 'Body'), 'fc' ); -} - -/** - * FixDateForFP - * - * @param $FeedType - * @param $Date (can be omited) - */ -function FixDateForFP( $FeedType, $Date = '' ) -{ - switch ( $FeedType ) - { - case 'RSS2': $DateFormat = 'r'; break; - case 'ATOM': $DateFormat = 'Y-m-d\TH:i:sO'; break; - default: $DateFormat = 'r'; - } - - // make a date for 'now' - if ( $Date == '' ) $Date = mktime(); - else $Date = UnixTimestamp( $Date ); - - // format the date - $FixedDate = date( $DateFormat, $Date ); - - // quick fix for ATOM - if ( strlen( $FixedDate ) == 24 ) - $FixedDate = substr( $FixedDate, 0, 22 ).':'.substr( $FixedDate, 22 ); - - return $FixedDate; -} - -/** - * FormatStringForFeedSummary - * - * @param $String - */ -function FormatStringForFeedSummary( $String ) -{ - $sReturn = strip_tags( $String ); - $sReturn = htmlspecialchars( $sReturn ); - $sReturn = SliceString( $sReturn, 200 ); - return str_replace( '\r\n', ' ', $sReturn ); -} - -/** - * ReturnWrappedFeedForSearch - * - * @param $Context - * @param $FeedItems - */ -function ReturnWrappedFeedForSearch( &$Context, $FeedItems, $FeedType ) -{ - switch ( $FeedType ) - { - case 'RSS2': - return ' - '.StyleSheetTag( $Context, $FeedType ).' - - - ' - .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] - .' - ' . $Context->PageTitle . ' ' . $Context->GetKeywords - .' ' . $Context->GetAuthUserName ) - .' - ' . FixDateForFP( $FeedType ) . ' - ' . $Context->Configuration[ 'BASE_URL' ] . ' - - - Lussumo Vanilla '.APPLICATION_VERSION.' & Feed Publisher - - '.$FeedItems.' - - '; - - case 'ATOM': - $p = $Context->ObjectFactory->NewObject( $Context, 'Parameters' ); - $p->DefineCollection( $_GET ); - $SelfLink = GetUrl( - $Context->Configuration, $Context->SelfUrl, - '', '', '', '', $p->GetQueryString() ); - $p->Remove( 'Feed' ); - $AlternateLink = GetUrl( - $Context->Configuration, $Context->SelfUrl, - '', '', '', '', $p->GetQueryString() ); - return ' - '.StyleSheetTag( $Context, $FeedType ).' - - ' - .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] - .' - ' . ' ' . $Context->GetKeywords - .' ' . $Context->GetAuthUserName ) - .' - ' . FixDateForFP( $FeedType ) . ' - ' . $Context->Configuration[ 'BASE_URL' ] . ' - - - - Lussumo Vanilla & Feed Publisher - - '.$FeedItems.' - '; - - default: return ''; - } -} - -/** - * ReturnWrappedFeed - * - * @param $Context - * @param $FeedItems - */ -function ReturnWrappedFeed( &$Context, $FeedItems, $FeedType ) -{ - switch ( $FeedType ) - { - case 'RSS2': - return ' - '.StyleSheetTag( $Context, $FeedType ).' - - - ' - .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] - .' - ' . $Context->PageTitle ) - .' - ' . FixDateForFP( $FeedType ) . ' - ' . $Context->Configuration[ 'BASE_URL' ] . ' - - - Lussumo Vanilla ' . APPLICATION_VERSION . ' & Feed Publisher - - ' . $FeedItems . ' - - '; - - case 'ATOM': - $p = $Context->ObjectFactory->NewObject( $Context, 'Parameters' ); - $p->DefineCollection( $_GET ); - $SelfLink = GetUrl( - $Context->Configuration, $Context->SelfUrl, - '', '', '', '', $p->GetQueryString() ); - $p->Remove( 'Feed' ); - $AlternateLink = GetUrl( - $Context->Configuration, $Context->SelfUrl, - '', '', '', '', $p->GetQueryString() ); - - return ' - '.StyleSheetTag( $Context, $FeedType ).' - - ' - .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] - .' - '.$Context->PageTitle ) - .' - ' . FixDateForFP( $FeedType ) . ' - ' . $Context->Configuration[ 'BASE_URL' ] . ' - - - - Lussumo Vanilla & Feed Publisher - - '.$FeedItems.' - '; - - default: return ''; - } -} - -/** - * ReturnFeedItemForFeed - * - * @param $Properties - */ -function ReturnFeedItem( $Properties, $FeedType ) -{ - switch ( $FeedType ) - { - case 'RSS2': - return ' - ' . $Properties[ 'Title' ] . ' - ' . $Properties[ 'Link' ] . ' - ' . $Properties[ 'Link' ] . ' - ' . $Properties[ 'Published' ] . ' - ' . $Properties[ 'AuthorName' ] . ' - - - - - '; - - case 'ATOM': - return ' - '.$Properties['Title'].' - - '.$Properties['Link'].' - '.$Properties['Published'].' - '.$Properties['Updated'].' - - '.$Properties['AuthorName'].' - '.$Properties['AuthorUrl'].' - - - '.$Properties['Summary'].' - - - - - - '; - - default: return ''; - } -} - -/** - * StyleSheetTag - * - * @param $Context - * @param $FeedType - */ -function StyleSheetTag( &$Context, $FeedType ) -{ - $return = ''; - - $ConfigKey = 'fp_StyleSheet_'.$FeedType; - if ( - array_key_exists( $ConfigKey, $Context->Configuration ) - AND !empty( $Context->Configuration[ $ConfigKey ] ) ) - { - foreach( $Context->Configuration[ $ConfigKey ] as $attributes_array ) - { - if ( empty( $attributes_array ) ) continue; - $return.= ' $val ) - { - $return.= ' '.$att.'="'.$val.'"'; - } - $return.= '?>'; - } - } - return $return; -} \ No newline at end of file diff --git a/extensions/FeedPublisher/global_functions.php b/extensions/FeedPublisher/global_functions.php deleted file mode 100755 index 97cfa6f..0000000 --- a/extensions/FeedPublisher/global_functions.php +++ /dev/null @@ -1,81 +0,0 @@ -Remove( 'DiscussionID' ); - // force page 1 at all times - $Parameters->Remove( 'page' ); - $Parameters->Set( 'page', 1 ); - // build Uri - $Uri = GetRequestUri(); - $Uri = explode( '?', $Uri ); - $Uri = $Uri[ 0 ]; - return $Uri . '?' . $Parameters->GetQueryString(); -} - -/** - * AddLinks - * - * Adds a clickable link to the Vanilla panel - * and adds an 'auto-discovery' link in the html head section. - * - * @param $Context - * @param $Properties - */ -function AddLinks( &$Context, &$Head, &$Panel, $Properties ) -{ - // prepare parameters for the GetFeedUriForFeed() function - $p = $Context->ObjectFactory->NewObject($Context, 'Parameters'); - $p->DefineCollection( $_GET ); - $p->Set( 'Feed', $Properties[ 'FeedType' ] ); - - $FeedUrl = GetFeedUriForFeed( $Context->Configuration, $p ); - - // to the panel - ///// - - // prepare some strings - $ListName = $Context->GetDefinition( 'Feeds' ); - $ListItem = $Context->GetDefinition( $Properties[ 'FeedType' ] . 'Feed' ); - $BodyTitle = $Context->GetDefinition( - 'FP_feedLinkToolTip_' . $Properties[ 'PageType' ] ); - - // add link - $Panel->AddList( $ListName, 5 ); - $Panel->AddListItem( - $ListName, - $ListItem, - $FeedUrl, - '', - 'title="' . $BodyTitle . '" class="'.$Properties[ 'FeedType' ].'"' ); - - // to the html head section - ///// - - // quick fix for the MIME type - if ( $Properties[ 'FeedType' ] == 'RSS2' ) - $MIME = 'rss'; - else $MIME = strtolower( $Properties[ 'FeedType' ] ); - - // prepare title - $HeadTitle = $Context->GetDefinition( $Properties[ 'FeedType' ] . 'Feed' ); - - // add link - $HeadLink = 'AddString( $HeadLink ); -} \ No newline at end of file diff --git a/extensions/FeedPublisher/readme.txt b/extensions/FeedPublisher/readme.txt deleted file mode 100755 index e8a30f4..0000000 --- a/extensions/FeedPublisher/readme.txt +++ /dev/null @@ -1,63 +0,0 @@ -=================================== -EXTENSION INSTALLATION INSTRUCTIONS -=================================== - - -YOU MUST MANUALLY CONFIGURE categories_config.php.php FOR THIS ADD-ON TO WORK!!! - - -In order for Vanilla to recognize an extension, it must be contained within it's -own directory within the extensions directory. So, once you have downloaded and -unzipped the extension files, you can then place the folder containing the -default.php file into your installation of Vanilla. The path to your extension's -default.php file should look like this: - -/path/to/vanilla/extensions/FeedPublisher/default.php - -Once this is complete, you can enable the extension through the "Manage -Extensions" form on the settings tab in Vanilla. - - -UPGRADE INSTRUCTIONS - -from 0.3.0 to 0.3.2 and intermediates -replace default.php - -from 0.2.0 to 0.3.0 -replace default.php, functions.php by the new files - optional: replace readme.txt and changelog.txt too - add - - /** - * Whether to stop Vanilla processing or not - * - * True will save some resources, while - * False will allow you to use SimpleCache. - */ - $fp_conf[ 'ExitAfterFeed' ] = false; - - somewhere in your config.php file - - -HISTORY - -This extension is the continuation of CrudeRSS, which added functionality -to resolve pagination issues and most-recent comment issues with Mark's -'RSS2' extension. - -CrudeRSS added contextual descriptions to the search.php rss title so -that users can properly organize their live bookmarks for the search.php -rss feeds. - -Additionally, CrudeRSS completely removed the automatic rss feeds for -index.php and manually applied the search.php rss feeds to -index.php pages. - -This was done for two reasons. -1) the search.php rss feeds contain content that is more appropriate for - feeds (the most recent comments and replies). -2) by manually applying the rss feeds to index.php pages (which includes - the "all discussions" page and individual category pages) one can, - if one chooses, give the urls to FeedBurner and then manually - substitute the FeedBurner rss urls into the index.php feeds. - This of course is optional, and requires a bit of manual organization. diff --git a/extensions/FeedPublisher/translations/Castellano.php b/extensions/FeedPublisher/translations/Castellano.php deleted file mode 100755 index d84414e..0000000 --- a/extensions/FeedPublisher/translations/Castellano.php +++ /dev/null @@ -1,16 +0,0 @@ -Dictionary[ "Feeds" ] - = "Suscripciones"; - $Context->Dictionary[ "FP_feedLinkToolTip_discussion" ] - = "Suscribirse a esta conversación"; - $Context->Dictionary[ "FP_feedLinkToolTip_search" ] - = "Suscribirse a esta búsqueda"; - $Context->Dictionary[ "RSS2Feed" ] - = "RSS2"; - $Context->Dictionary[ "ATOMFeed" ] - = "ATOM"; - $Context->Dictionary[ "FailedFeedAuthenticationTitle" ] - = "Error de autenticación"; - $Context->Dictionary[ "FailedFeedAuthenticationText" ] - = "La suscripción a este foro requiere autenticación."; -?> diff --git a/extensions/FeedPublisher/translations/french.php b/extensions/FeedPublisher/translations/french.php deleted file mode 100755 index 917c853..0000000 --- a/extensions/FeedPublisher/translations/french.php +++ /dev/null @@ -1,16 +0,0 @@ -Dictionary[ "Feeds" ] - = "Flux"; - $Context->Dictionary[ "FP_feedLinkToolTip_discussion" ] - = "S'inscrire au flux de cette discussion"; - $Context->Dictionary[ "FP_feedLinkToolTip_search" ] - = "S'inscrire au flux de cette recherche"; - $Context->Dictionary[ "RSS2Feed" ] - = "RSS2"; - $Context->Dictionary[ "ATOMFeed" ] - = "ATOM"; - $Context->Dictionary[ "FailedFeedAuthenticationTitle" ] - = "Echec lors de l'authentification"; - $Context->Dictionary[ "FailedFeedAuthenticationText" ] - = "Les flux de ce forum nécessitent votre authentification."; -?> diff --git a/extensions/FeedPublisher/translations/readme.txt b/extensions/FeedPublisher/translations/readme.txt deleted file mode 100755 index f786492..0000000 --- a/extensions/FeedPublisher/translations/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -Translation - -You should cut & paste these language definitions into your conf/xxx.php file. -Replace "xxx" with your chosen language. diff --git a/extensions/FeedThis/default.php b/extensions/FeedThis/default.php new file mode 100755 index 0000000..64fd491 --- /dev/null +++ b/extensions/FeedThis/default.php @@ -0,0 +1,273 @@ + $value) + { + $Context->Configuration['FT_'.$key] = $value; + } + unset($ft_conf); + } + +//Settings panel for Feed Publisher +if (($Context->SelfUrl == 'settings.php') && $Context->Session->User->Permission('PERMISSION_CHANGE_APPLICATION_SETTINGS')) + { + $FPForm = $Context->ObjectFactory->NewContextObject($Context, 'FTForm'); + $Page->AddRenderControl($FPForm, $Configuration["CONTROL_POSITION_BODY_ITEM"]); + $ExtensionOptions = $Context->GetDefinition('Extension Options'); + $Panel->AddList($ExtensionOptions); + $Panel->AddListItem($ExtensionOptions, $Context->GetDefinition('FTSettings'), GetUrl($Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction=FeedThis')); + } + +//Is this a feed, or normal browsing? +$FeedType = ForceIncomingString ('Feed', ''); + +//If this is a feed, is it one of the configured to be allowed? +if (!in_array ($FeedType, $Context->Configuration['FT_PUBLISHED_TYPES'])) + { + $FeedType = ''; + } +else + { + //Adds ability to search by CategoryID, DiscussionID or AuthUserID for Comment Searches + $Context->AddToDelegate("CommentManager", "SearchBuilder_PostWhere", "Search_FeedAddQuery"); + + //Changes the order of Discussion Searches + $Context->AddToDelegate("DiscussionManager", "PostGetDiscussionBuilder", "Search_FeedAddQueryDiscussions"); + } + +//Pages that should be processed. +$processed_pages = array( 'index.php', 'search.php', 'comments.php', 'categories.php', 'extension.php', 'account.php'); + +if (in_array ($Context->SelfUrl, $processed_pages)) + { + //For non-feed + if ($FeedType == '') + { + //display all discussions + if (($Context->SelfUrl == "index.php" || $Context->SelfUrl == "categories.php" || $Context->Configuration['FT_ALLDISCUSSIONS_FEED_EVERY']) && !ForceIncomingInt("CategoryID", '') && ($Context->Configuration['FT_ALLDISCUSSIONS_FEED']) || $Context->Configuration['FT_ALLDISCUSSIONS_FEED_EVERY']) + { + unset ($Properties); + $Properties['SearchType'] = "Topics"; + $Properties['ListName'] = $Context->GetDefinition('AllDiscussionsFeed'); + $Properties['Extra'] = "&FeedTitle=".urlencode($Properties['ListName']); + AddLinksForEach($Properties); + } + //display category listing + if (($Context->SelfUrl == "index.php" || $Context->SelfUrl == "categories.php") && ($CategoryID = ForceIncomingInt("CategoryID", '')) && $Context->Configuration['FT_CATEGORY_FEED']) + { + unset ($Properties); + $Properties['SearchType'] = "Topics"; + $Properties['ListName'] = $Context->GetDefinition('CategoryFeed'); + $Properties['Extra'] = "&CategoryID=".$CategoryID."&FeedTitle=".urlencode($Properties['ListName']." (".GetCategoryName($CategoryID).")"); + AddLinksForEach($Properties); + } + //BlogThis feed + if (($Context->SelfUrl == "extension.php" && (ForceIncomingString("PostBackAction", '') == 'Blog') && $Context->Configuration['FT_BLOG_FEED']) || $Context->Configuration['FT_BLOG_FEED_EVERY']) + { + unset ($Properties); + //Support for per-user Blog RSS Feed + $BlogUser = ForceIncomingString("BlogUser", ''); + if ($BlogUser) + { + $Extra = " (".GetUserName($BlogUser).")"; + $BlogUser = "&AuthUserID=".$BlogUser; + } + + $Properties['SearchType'] = "Comments"; + $Properties['ListName'] = $Context->GetDefinition('BlogFeed'); + $Properties['Extra'] = "&BlogSearch=1".@$BlogUser."&FeedTitle=".urlencode($Properties['ListName'].@$Extra); + AddLinksForEach($Properties); + } + if ($Context->SelfUrl == "account.php") + { + $UserID = ForceIncomingString('u', $Context->Session->UserID); + $UserManager = $Context->ObjectFactory->NewContextObject($Context, 'UserManager'); + $User = $UserManager->GetUserById($UserID); + + //Add user Blog Feed + if (array_key_exists('BLOGTHIS', $Configuration) && $Context->Configuration['FT_USERBLOG_FEED'] && ($User->Permission('PERMISSION_CANBLOGTHIS') || $User->Permission('PERMISSION_CANBLOGALL'))) + { + unset ($Properties); + $Properties['SearchType'] = "Comments"; + $Properties['ListName'] = $Context->GetDefinition('UserBlogFeed'); + $Properties['Extra'] = "&BlogSearch=1&AuthUserID=".($UserID)."&FeedTitle=".urlencode($Properties['ListName']." (".GetUserName($UserID).")"); + AddLinksForEach($Properties); + } + //Add user's Comments + if ($Context->Configuration['FT_USERCOMMENTS_FEED']) + { + unset ($Properties); + $Properties['SearchType'] = "Comments"; + $Properties['ListName'] = $Context->GetDefinition('UserCommentsFeed'); + $Properties['Extra'] = "&AuthUserID=".($UserID)."&FeedTitle=".urlencode($Properties['ListName']." (".GetUserName($UserID).")"); + AddLinksForEach($Properties); + } + } + //Discussion comments + if ($Context->SelfUrl == "comments.php" && ($DiscussionID = ForceIncomingInt("DiscussionID", '')) && $Context->Configuration['FT_DISCUSSION_FEED']) + { + unset ($Properties); + $Properties['SearchType'] = "Comments"; + $Properties['ListName'] = $Context->GetDefinition('DiscussionFeed'); + $Properties['Extra'] = "&DiscussionID=".$DiscussionID."&FeedTitle=".urlencode($Properties['ListName']." (".GetDiscussionName($DiscussionID).")"); + AddLinksForEach($Properties); + } + //Search Results + if ($Context->SelfUrl == "search.php" && ForceIncomingString("PostBackAction", '') == 'Search' && $Context->Configuration['FT_SEARCHRESULTS_FEED']) + { + unset ($Properties); + $Tag = ForceIncomingString("Tag", ''); + $Keywords = ForceIncomingString("Keywords", ''); + $Authusername = ForceIncomingString("AuthUsername", ''); + $Categories = ForceIncomingString("Categories", ''); + $Advanced = ForceIncomingInt("Advanced", ''); + $Type = ForceIncomingString("Type", ''); + + $Extra = ""; + + //Add them to the search string. + if ($Tag) + { + $Extra.= "Tag: ".$Tag." "; + $Tag = "&Tag=".$Tag; + } + + if ($Keywords) + { + $Extra.= "Keywords: ".$Keywords.", "; + $Keywords = "&Keywords=".$Keywords; + } + + if ($Authusername) + { + $Extra.= "Author: ".$Authusername.", "; + $Authusername = "&AuthUsername=".$Authusername; + } + + if ($Categories) + { + $Extra.= "Category: ".$Categories.", "; + $Categories = "&Categories=".$Categories; + } + + if ($Advanced) + { + $Advanced = "&Advanced=".$Advanced; + } + + + if ($Extra == "") + { + unset($Extra); + } + else + { + $Extra = " (".substr($Extra,0,strlen($Extra)-1).")"; + } + + $Properties['SearchType'] = $Type; + $Properties['ListName'] = $Context->GetDefinition('SearchFeed'); + $Properties['Extra'] = @$Tag.@$Keywords.@$Authusername.@$Categories.@$Advanced."&FeedTitle=".urlencode($Properties['ListName'].@$Extra); + AddLinksForEach($Properties); + } + } + //For feed + else + { + // Make sure that page is not redirected if the user is not signed in and this is not a public forum + if ($Context->Session->UserID == 0 && !$Configuration["PUBLIC_BROWSING"]) + { + // Temporarily make the PUBLIC_BROWSING enabled, but make sure to validate this user + $Configuration[ "PUBLIC_BROWSING" ] = 1; + $Context->Configuration['FT_AUTHENTICATE_USER'] = 1; + } + else + { + $Context->Configuration[ 'FT_AUTHENTICATE_USER' ] = 0; + } + + //Exit the feed? For compatibility with SimpleCache + if (!$Context->Configuration['FT_EXIT_AFTER_FEED']) + { + $Context->AddToDelegate('PageEnd', 'PostRender', 'CleanBufferAndDisplayFeed'); + } + } + + //This is where the magic happens. ALL feeds originate from a search. + if ($Context->SelfUrl == "search.php" && $FeedType) + { + //Override the number of search results. + $Context->Configuration['SEARCH_RESULTS_PER_PAGE'] = $Context->Configuration['FT_FEED_ITEMS']-1; + + //Get search parameters from the URL + $SearchType = ForceIncomingString( "Type", "" ); + $SearchID = ForceIncomingInt( "SearchID", 0); + + //If no search type in the url but we found an 'id', so grab the search type from the 'id' + if ($SearchType == "" && $SearchID > 0) + { + $SearchManager = $Context->ObjectFactory->NewContextObject($Context, "SearchManager"); + $Search = $SearchManager->GetSearchById($SearchID); + if ($Search) + { + $SearchType = $Search->Type; + } + } + + if ($SearchType == "Topics" || $SearchType == "Discussions") + { + //Think this could be a bug in Vanilla itself - so a work around... + $SearchType = "Topics"; + + //Make sure that the first comment is also grabbed from the search + $Context->AddToDelegate("DiscussionManager", "PostGetDiscussionBuilder", "DiscussionManager_GetFirstCommentForFeeds" ); + + $Context->AddToDelegate("SearchForm", "PostLoadData", "SearchForm_InjectFeedToTopicSearch"); + } + elseif ($SearchType == "Comments") + { + $Context->AddToDelegate ("SearchForm", "PostLoadData", "SearchForm_InjectFeedToCommentSearch"); + } + } + } diff --git a/extensions/FeedThis/feedthis.png b/extensions/FeedThis/feedthis.png new file mode 100644 index 0000000000000000000000000000000000000000..8b78260239088dbfbf99a8504f85db2064016fa4 GIT binary patch literal 5541 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 T7_CJQfZI(iBUq)zov42R?o(WV literal 0 HcwPel00001 diff --git a/extensions/FeedThis/finetune.php b/extensions/FeedThis/finetune.php new file mode 100755 index 0000000..f0db517 --- /dev/null +++ b/extensions/FeedThis/finetune.php @@ -0,0 +1,53 @@ +' ][] for use of several style sheets. + */ + +/* +EXAMPLES: + +// To Add +// < ?xml-stylesheet href="/rss.css" type="text/css"? >, use + +$ft_conf[ 'STYLESHEET_RSS2' ][] = array( + 'href' => '/rss.css', + 'type' => 'text/css' ); + +// To Add +// < ?xml-stylesheet type="text/xsl" href="style.xsl" media="screen"? > +// < ?xml-stylesheet href="http://www.site.com/atom.css" type="text/css"? >, use + +$ft_conf[ 'STYLESHEET_ATOM' ][] = array( + 'type' => 'text/xsl', + 'href' => 'style.xsl', + 'media'=> 'screen' ); +$ft_conf[ 'STYLESHEET_ATOM' ][] = array( + 'href' => 'http://www.site.com/atom.css', + 'type' => 'text/css' ); +*/ + diff --git a/extensions/FeedThis/languages/english.php b/extensions/FeedThis/languages/english.php new file mode 100755 index 0000000..3986136 --- /dev/null +++ b/extensions/FeedThis/languages/english.php @@ -0,0 +1,31 @@ +SetDefinition("Feeds", "Feeds"); +$Context->SetDefinition("RSS2Feed", "RSS2"); +$Context->SetDefinition("ATOMFeed", "ATOM"); +$Context->SetDefinition("FailedFeedAuthenticationTitle", "Failed Authentication"); +$Context->SetDefinition("FailedFeedAuthenticationText", "Feeds for this forum require user authentication."); +$Context->SetDefinition('AllDiscussionsFeed', "All Discussions Feed"); +$Context->SetDefinition('DiscussionFeed', "Discussion Feed"); +$Context->SetDefinition('BlogFeed', "Blog Feed"); +$Context->SetDefinition('UserBlogFeed', "User's Blog Feed"); +$Context->SetDefinition('UserCommentsFeed', "User's Comments Feed"); +$Context->SetDefinition('SearchFeed', "Search Results Feed"); +$Context->SetDefinition('CategoryFeed', "Category Feed"); +$Context->SetDefinition('SubscribeFeed', "Subscribe to this feed..."); +$Context->SetDefinition('FTSettings', "FeedThis Settings"); +$Context->SetDefinition('FeedSettings', "Feeds to Display"); +$Context->SetDefinition('BlogFeedSetting', "Blog Feed (Requires BlogThis Extension)"); +$Context->SetDefinition('BlogFeedEverySetting', "Display Blog Feed on EVERY Page."); +$Context->SetDefinition('AllDiscussionsFeedSetting', "All Discussions Feed"); +$Context->SetDefinition('AllDiscussionsFeedEverySetting', "Display All Discussion Feed on EVERY Page."); +$Context->SetDefinition('DiscussionFeedSetting', "Individual Discussion Feed"); +$Context->SetDefinition('CategoryFeedSetting', "Individual Category Feed"); +$Context->SetDefinition('SearchResultsFeedSetting', "Search Results Feed"); +$Context->SetDefinition('UserBlogFeedSetting', "User's Blog Posts Feed (Requires BlogThis Extension)"); +$Context->SetDefinition('UserCommentsFeedSetting', "User's Comments Feed"); +$Context->SetDefinition('NoSideBarFeedSetting', "Turn off Side Bar Links?"); +$Context->SetDefinition('FeedExtraSettings', "Extra Settings"); +$Context->SetDefinition('FeedPanelPosition', "Position in Panel (1-200)"); +$Context->SetDefinition('FeedItems', "Number of items to display in feed"); +$Context->SetDefinition('WordLimit', "Number of words to display per post (0 for all)"); +?> diff --git a/extensions/FeedThis/library/Function.FeedThis.php b/extensions/FeedThis/library/Function.FeedThis.php new file mode 100644 index 0000000..eb32e4a --- /dev/null +++ b/extensions/FeedThis/library/Function.FeedThis.php @@ -0,0 +1,582 @@ +Configuration['DATABASE_TABLE_PREFIX']."Discussion WHERE `DiscussionID` = \"".FormatStringForDatabaseInput($DiscussionID)."\";"; + $result = $Context->Database->Execute($sql, 'FeedThis', 'GetDiscussionName' , 'An error occurred while fetching the discussion name.'); + $row = $Context->Database->GetRow($result); + + return $row['Name']; + } + +//Gets Category Name from ID +function GetCategoryName ($CategoryID) + { + global $Context; + $sql = "SELECT Name FROM ".$Context->Configuration['DATABASE_TABLE_PREFIX']."Category WHERE `CategoryID` = \"".FormatStringForDatabaseInput($CategoryID)."\";"; + $result = $Context->Database->Execute($sql, 'FeedThis', 'GetCategoryName' , 'An error occurred while fetching the category name.'); + $row = $Context->Database->GetRow($result); + + return $row['Name']; + } + +//Gets User Name from ID +function GetUserName ($UserID) + { + global $Context; + $sql = "SELECT Name FROM ".$Context->Configuration['DATABASE_TABLE_PREFIX']."User WHERE `UserID` = \"".FormatStringForDatabaseInput($UserID)."\";"; + $result = $Context->Database->Execute($sql, 'FeedThis', 'GetUserName' , 'An error occurred while fetching the user name.'); + $row = $Context->Database->GetRow($result); + + return $row['Name']; + } + +//Adds panel links for each RSS Feed +function AddLinksForEach ($Properties) + { + global $Context; + global $Panel; + global $Head; + //Now we have parameters, put the links up + foreach ($Context->Configuration['FT_PUBLISHED_TYPES'] as $PublishedType) + { + $Properties['FeedType'] = $PublishedType; + if (@$Properties['SearchType'] != "Users" && @$Properties['ListName']) + { + AddLinks($Context, $Head, $Panel, $Properties); + } + } + } + +//Gets the URI for the requested feed +function GetFeedUriForFeed (&$Configuration, $Parameters) + { + global $Context; + if (($Parameters['ListName'] == $Context->GetDefinition('BlogFeed')) && isset($Configuration['FT_BLOGFEED_ALT'] [$Parameters['FeedType']])) {return $Configuration['FT_BLOGFEED_ALT'] [$Parameters['FeedType']];} + if (($Parameters['ListName'] == $Context->GetDefinition('AllDiscussionsFeed')) && isset($Configuration['FT_ALLDISCUSSIONS_ALT'] [$Parameters['FeedType']])) {return $Configuration['FT_ALLDISCUSSIONS_ALT'] [$Parameters['FeedType']];} + + return GetUrl($Configuration, "search.php", '', '', '', '', "PostBackAction=Search&Type=".$Parameters['SearchType']."&Page=1&Feed=" . $Parameters['FeedType'].@$Parameters['Extra'], ''); + } + + +//Adds the feed links to the side panel +function AddLinks (&$Context, &$Head, &$Panel, $Properties) + { + $FeedUrl = GetFeedUriForFeed ($Context->Configuration, $Properties); + + $ListName = $Properties['ListName']; + $ListItem = $Context->GetDefinition($Properties['FeedType'].'Feed'); + $BodyTitle = $Context->GetDefinition('SubscribeFeed'); + + //Add link + + if (!$Context->Configuration['FT_NOSIDEBAR']) + { + $Panel->AddList ($ListName, $Context->Configuration['FT_PANEL_POSITION']); + $Panel->AddListItem($ListName, $ListItem, $FeedUrl, '', 'title="'.$BodyTitle.'" class="'.$Properties['FeedType'].'"'); + } + + //Add to HTML HEAD section + + //Quick fix for the MIME type + if ($Properties['FeedType'] == 'RSS2') + { + $MIME = 'rss'; + } + else { + $MIME = strtolower ($Properties['FeedType']); + } + + //Add link + $HeadLink = 'AddString( $HeadLink ); + } + +//Allows to search by CategoryID and DiscussionID and AuthUserID +function Search_FeedAddQuery(&$CommentManager) + { + $s = &$CommentManager->DelegateParameters ['SqlBuilder']; + + if ($AuthUserID = ForceIncomingInt('AuthUserID', '')) + { + $s->AddWhere('c', 'AuthUserID', '', FormatStringForDatabaseInput($AuthUserID), '=', 'and'); + } + + if ($CategoryID = ForceIncomingInt('CategoryID', '')) + { + $s->AddWhere('d', 'CategoryID', '', FormatStringForDatabaseInput($CategoryID), '=', 'and'); + } + + if ($DiscussionID = ForceIncomingInt('DiscussionID', '')) + { + $s->AddWhere('d', 'DiscussionID', '', FormatStringForDatabaseInput($DiscussionID), '=', 'and'); + } + $s->AddOrderBy('DateCreated', 'd', $SortDirection = 'desc'); + } + +//Orders All Discussions Properly +function Search_FeedAddQueryDiscussions(&$DiscussionManager) + { + $s = &$DiscussionManager->DelegateParameters ['SqlBuilder']; + + $s->AddOrderBy('DateLastActive', 't', $SortDirection = 'desc'); + } + +//Gets the first comment for a discussion and also add search by IDs +function DiscussionManager_GetFirstCommentForFeeds ($DiscussionManager) + { + $s = &$DiscussionManager->DelegateParameters ['SqlBuilder']; + $s->AddJoin ('Comment', 'fc2', 'CommentID', 't', 'FirstCommentID', 'left join'); + + if ($AuthUserID = ForceIncomingInt('AuthUserID', '')) + { + $s->AddWhere('t', 'AuthUserID', '', FormatStringForDatabaseInput($AuthUserID), '=', 'and'); + } + + if ($CategoryID = ForceIncomingInt('CategoryID', '')) + { + $s->AddWhere('t', 'CategoryID', '', FormatStringForDatabaseInput($CategoryID), '=', 'and'); + } + + if ($DiscussionID = ForceIncomingInt('DiscussionID', '')) + { + $s->AddWhere('t', 'DiscussionID', '', FormatStringForDatabaseInput($DiscussionID), '=', 'and'); + } + + $s->AddSelect (array('FormatType', 'Body'), 'fc2'); + } + + +//Renders Comment Searches +function SearchForm_InjectFeedToCommentSearch($SearchForm) + { + global $FeedType; + + if ($SearchForm->Context->WarningCollector->Count() == 0) + { + AuthenticateUserForFT ($SearchForm->Context); + + $SearchForm->Context->PageTitle = ForceIncomingString ("FeedTitle", ""); + + //Loop through the data + $Counter = 0; + $Feed = ""; + $Properties = array(); + $Comment = $SearchForm->Context->ObjectFactory->NewContextObject ($SearchForm->Context, "Comment"); + + while ($Row = $SearchForm->Context->Database->GetRow ($SearchForm->Data)) + { + $Comment->Clear(); + $Comment->GetPropertiesFromDataSet( $Row, $SearchForm->Context->Session->UserID ); + + if ($Counter < $SearchForm->Context->Configuration["SEARCH_RESULTS_PER_PAGE" ]) + { + $Properties["Title"] = FormatHtmlStringInline (ForceString($Comment->Discussion, "" )); + $Properties["Link"] = GetUrl ($SearchForm->Context->Configuration, "comments.php", "", "DiscussionID", $Comment->DiscussionID, CleanupString($Comment->Discussion), "Focus=".$Comment->CommentID."#Comment_".$Comment->CommentID); + $Properties["Published"] = FixDateForFT ($FeedType, @$Row["DateCreated"]); + $Properties["Updated"] = FixDateForFT ($FeedType, @$Row["DateEdited" ]); + $Properties["AuthorName"] = $Comment->AuthUsername; + $Properties["AuthorUrl"] = GetUrl ($SearchForm->Context->Configuration, "account.php", "", "u", $Comment->AuthUserID); + + //Format the comment according to the defined formatter for that comment + $Properties["Content"] = $SearchForm->Context->FormatString (CutShortString($Comment->Body), $Comment, $Comment->FormatType, FORMAT_STRING_FOR_DISPLAY); + $Properties["Summary"] = FormatStringForFeedSummary (@$Properties["Content"]); + + $Feed.= ReturnFeedItem ($Properties, $FeedType); + } + else + { + break; + } + $Counter++; + } + + $Feed = ReturnWrappedFeedForSearch( $SearchForm->Context, $Feed, $FeedType ); + + if ($SearchForm->Context->Configuration['FT_EXIT_AFTER_FEED']) + { + // Set the content type to xml and dump the feed + header("Content-type: text/xml\n"); + echo ($Feed); + + // When all finished, unload the context object and stop + $SearchForm->Context->Unload(); + exit; + } + else + { + // store the feed in the context object + $SearchForm->Context->Feed = $Feed; + } + } + } + +//Renders Topic Searches +function SearchForm_InjectFeedToTopicSearch ($SearchForm) + { + global $FeedType; + + if ($SearchForm->Context->WarningCollector->Count() == 0) + { + AuthenticateUserForFT ($SearchForm->Context); + + $SearchForm->Context->PageTitle = ForceIncomingString ("FeedTitle", ""); + + //Loop through the data + $Counter = 0; + $Feed = ""; + $Properties = array(); + while ($DataSet = $SearchForm->Context->Database->GetRow($SearchForm->Data)) + { + $Properties["Title"] = FormatHtmlStringInline(ForceString ($DataSet["Name"], "")); + $Properties["Link"] = GetUrl($SearchForm->Context->Configuration, "comments.php", "", "DiscussionID", ForceInt($DataSet["DiscussionID"], 0), CleanupString($DataSet["Name"])); + $Properties["Published"] = FixDateForFT ($FeedType, @$DataSet["DateCreated"]); + $Properties["Updated"] = FixDateForFT ($FeedType, @$DataSet["DateLastActive"]); + $Properties["AuthorName"] = FormatHtmlStringInline (ForceString ($DataSet["AuthUsername"], "")); + $Properties["AuthorUrl"] = GetUrl ($SearchForm->Context->Configuration, "account.php", "", "u", ForceInt ($DataSet["AuthUserID"], 0)); + + // Format the comment according to the defined formatter for that comment + $FormatType = ForceString (@$DataSet[ "FormatType" ], $SearchForm->Context->Configuration[ "DEFAULT_FORMAT_TYPE" ] ); + $FirstCommentBody = ForceString(@trim($DataSet[ "Body" ]), '...' ); + $Properties[ "Content" ] = $SearchForm->Context->FormatString (CutShortString($FirstCommentBody), $SearchForm, $FormatType, FORMAT_STRING_FOR_DISPLAY); + $Properties[ "Summary" ] = FormatStringForFeedSummary (@$Properties[ "Content" ]); + + $Feed.= ReturnFeedItem ($Properties, $FeedType); + + $Counter++; + } + + $Feed = ReturnWrappedFeedForSearch($SearchForm->Context, $Feed, $FeedType); + + if ($SearchForm->Context->Configuration['FT_EXIT_AFTER_FEED']) + { + //Set the content type to xml and dump the feed + header("Content-type: text/xml\n"); + echo ($Feed); + + //When all finished, unload the context object and stop + $SearchForm->Context->Unload(); + exit; + } + else + { + //Store the feed in the context object + $SearchForm->Context->Feed = $Feed; + } + } + } + +function AuthenticateUserForFT (&$Context) + { + //Perform some HTTP authentication if public browsing is not enabled. + if ($Context->Configuration['FT_AUTHENTICATE_USER']) + { + //Assume user is not authenticated. + $UserIsAuthenticated = false; + + $PHP_AUTH_USER = ForceString (@$_SERVER['PHP_AUTH_USER'], ''); + $PHP_AUTH_PW = ForceString (@$_SERVER['PHP_AUTH_PW'], ''); + + if ($PHP_AUTH_USER && $PHP_AUTH_PW) + { + $Auth = $Context->ObjectFactory->NewContextObject($Context, "Authenticator"); + $result = $Auth->Authenticate (FormatStringForDatabaseInput( $PHP_AUTH_USER ), FormatStringForDatabaseInput( $PHP_AUTH_PW ), '1'); + + if ($result) {$UserIsAuthenticated = true;} + } + + //Couldn't authenticate + if (!$UserIsAuthenticated) + { + header ('WWW-Authenticate: Basic realm="Private"'); + header ('HTTP/1.0 401 Unauthorized'); + + echo ('

'.$Context->GetDefinition ('FailedFeedAuthenticationTitle').'

'.$Context->GetDefinition ('FailedFeedAuthenticationText').'

'); + $Context->Unload(); + die(); + } + } + } + + +function CleanBufferAndDisplayFeed ($PageEnd) + { + ob_end_clean(); + ob_start(); + header ("Content-type: text/xml\n"); + if (!empty ($PageEnd->Context->Feed)) + { + echo $PageEnd->Context->Feed; + } + } + + +//Sort dates out depending on feed type +function FixDateForFT ($FeedType, $Date = '') + { + if ($FeedType == 'RSS2') + { + $DateFormat = 'r'; + } + elseif ($FeedType == 'ATOM') + { + $DateFormat = 'Y-m-d\TH:i:sO'; + } + else { + $DateFormat = 'r'; + } + + //Make a date for 'now' + if ($Date == '') + { + $Date = mktime(); + } + else + { + $Date = UnixTimestamp ($Date); + } + + //Apply formatting to date. + $FixedDate = date ($DateFormat, $Date); + + //Quick fix for ATOM + if (strlen ($FixedDate) == 24) + { + $FixedDate = substr ($FixedDate, 0, 22).':'.substr ($FixedDate, 22); + } + //All done! + return $FixedDate; + } + +//For making the summary section of ATOM feeds. +function FormatStringForFeedSummary ($String) + { + global $Context; + $sReturn = strip_tags ($String); + $sReturn = htmlspecialchars ($sReturn); + $sReturn = str_replace ('\r\n', ' ', $sReturn); + return SliceString ($sReturn, 200); + } + +//For summary creation! +function CutShortString ($String) + { + global $Context; + + if ($Context->Configuration['FT_WORD_LIMIT']) + { + $out = explode(" ", $String); + + if (count($out) <= $Context->Configuration['BLOG_WORD_LIMIT']) + { + $output = $String; + } + else + { + $output = ""; + + for ($i=0; $i < $Context->Configuration['FT_WORD_LIMIT'];$i++) + { + $output .= $out[$i] . " "; + } + + //take off the last space and add "..." + $output = trim($output) . "..."; + } + } + else + { + $output = $String; + } + + return $output; + } + + +function ReturnWrappedFeedForSearch (&$Context, $FeedItems, $FeedType) + { + if ($FeedType == 'RSS2') + { + return ''.StyleSheetTag( $Context, $FeedType ).' + + + ' + .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] + .' - ' . $Context->PageTitle ) + .' + ' . FixDateForFT( $FeedType ) . ' + ' . $Context->Configuration[ 'BASE_URL' ] . ' + + + Lussumo Vanilla '.APPLICATION_VERSION.' & Feed Publisher + + '.$FeedItems.' + + '; + } + elseif ($FeedType == 'ATOM') + { + $p = $Context->ObjectFactory->NewObject ($Context, 'Parameters'); + $p->DefineCollection ($_GET); + $SelfLink = GetUrl ($Context->Configuration, $Context->SelfUrl, '', '', '', '', $p->GetQueryString()); + $p->Remove ('Feed'); + $AlternateLink = GetUrl($Context->Configuration, $Context->SelfUrl, '', '', '', '', $p->GetQueryString()); + + return ''.StyleSheetTag ($Context, $FeedType).' + + ' + .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] + .' - ' . ' ' . $Context->PageTitle ) + .' + ' . FixDateForFT( $FeedType ) . ' + ' . $Context->Configuration[ 'BASE_URL' ] . ' + + + + Lussumo Vanilla & Feed Publisher + + '.$FeedItems.' + '; + } + else + { + return ''; + } + } + +function ReturnWrappedFeed (&$Context, $FeedItems, $FeedType) + { + if ($FeedType == 'RSS2') + { + return ''.StyleSheetTag( $Context, $FeedType ).' + + + ' + .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] + .' - ' . $Context->PageTitle ) + .' + ' . FixDateForFT( $FeedType ) . ' + ' . $Context->Configuration[ 'BASE_URL' ] . ' + + + Lussumo Vanilla ' . APPLICATION_VERSION . ' & Feed Publisher + + ' . $FeedItems . ' + + '; + } + elseif ($FeedType == 'ATOM') + { + $p = $Context->ObjectFactory->NewObject ($Context, 'Parameters'); + $p->DefineCollection ($_GET); + $SelfLink = GetUrl($Context->Configuration, $Context->SelfUrl,'', '', '', '', $p->GetQueryString()); + $p->Remove ('Feed'); + $AlternateLink = GetUrl($Context->Configuration, $Context->SelfUrl,'', '', '', '', $p->GetQueryString()); + + return ''.StyleSheetTag( $Context, $FeedType ).' + + ' + .htmlspecialchars( $Context->Configuration[ 'APPLICATION_TITLE' ] + .' - '.$Context->PageTitle ) + .' + ' . FixDateForFT( $FeedType ) . ' + ' . $Context->Configuration[ 'BASE_URL' ] . ' + + + + Lussumo Vanilla & Feed Publisher + + '.$FeedItems.' + '; + } + else + { + return ''; + } + } + +function ReturnFeedItem( $Properties, $FeedType ) + { + if ($FeedType == 'RSS2') + { + return ' + ' . $Properties[ 'Title' ] . ' + ' . $Properties[ 'Link' ] . ' + ' . $Properties[ 'Link' ] . ' + ' . $Properties[ 'Published' ] . ' + ' . $Properties[ 'AuthorName' ] . ' + + + + + '; + } + elseif ($FeedType == 'ATOM') + { + return ' + '.$Properties['Title'].' + + '.$Properties['Link'].' + '.$Properties['Published'].' + '.$Properties['Updated'].' + + '.$Properties['AuthorName'].' + '.$Properties['AuthorUrl'].' + + + '.$Properties['Summary'].' + + + + + + '; + } + else + { + return ''; + } + } + +function StyleSheetTag (&$Context, $FeedType) + { + $return = ''; + + $ConfigKey = 'FT_STYLESHEET_'.$FeedType; + + if (array_key_exists ($ConfigKey, $Context->Configuration) && !empty ($Context->Configuration[$ConfigKey])) + { + foreach ($Context->Configuration[$ConfigKey] as $attributes_array) + { + if (empty ($attributes_array)) + { + continue; + } + $return.= ' $val) + { + $return.= ' '.$att.'="'.$val.'"'; + } + + $return.= '?>'; + } + } + + return $return; + } diff --git a/extensions/FeedThis/library/PostBackControl.FeedThis.php b/extensions/FeedThis/library/PostBackControl.FeedThis.php new file mode 100644 index 0000000..dd47c1e --- /dev/null +++ b/extensions/FeedThis/library/PostBackControl.FeedThis.php @@ -0,0 +1,65 @@ +Name = 'FTForm'; + $this->ValidActions = array('FeedThis','ProcessFeedThis'); + $this->Constructor($Context); + + if ($this->IsPostBack) + { + $SettingsFile = $this->Context->Configuration['APPLICATION_PATH'].'conf/settings.php'; + $this->ConfigurationManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'ConfigurationManager'); + + if ($this->PostBackAction == 'ProcessFeedThis') + { + $this->ConfigurationManager->GetSettingsFromForm($SettingsFile); + $this->ConfigurationManager->DefineSetting('FT_BLOG_FEED', ForceIncomingBool('FT_BLOG_FEED', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_BLOG_FEED_EVERY', ForceIncomingBool('FT_BLOG_FEED_EVERY', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_ALLDISCUSSIONS_FEED', ForceIncomingBool('FT_ALLDISCUSSIONS_FEED', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_ALLDISCUSSIONS_FEED_EVERY', ForceIncomingBool('FT_ALLDISCUSSIONS_FEED_EVERY', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_DISCUSSION_FEED', ForceIncomingBool('FT_DISCUSSION_FEED', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_CATEGORY_FEED', ForceIncomingBool('FT_CATEGORY_FEED', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_SEARCHRESULTS_FEED', ForceIncomingBool('FT_SEARCHRESULTS_FEED', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_USERBLOG_FEED', ForceIncomingBool('FT_USERBLOG_FEED', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_USERCOMMENTS_FEED', ForceIncomingBool('FT_USERCOMMENTS_FEED', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_PANEL_POSITION', ForceIncomingInt('FT_PANEL_POSITION', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_FEED_ITEMS', ForceIncomingInt('FT_FEED_ITEMS', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_WORD_LIMIT', ForceIncomingInt('FT_WORD_LIMIT', 0), 0); + $this->ConfigurationManager->DefineSetting('FT_NOSIDEBAR', ForceIncomingInt('FT_NOSIDEBAR', 0), 0); + $this->DelegateParameters['ConfigurationManager'] = &$this->ConfigurationManager; + + // And save everything + if ($this->ConfigurationManager->SaveSettingsToFile($SettingsFile)) + { + header('location: '.GetUrl($this->Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction=FeedThis&Success=1')); + } + else + { + $this->PostBackAction = 'FeedThis'; + } + } + } + } + + function Render() + { + if ($this->IsPostBack) + { + $this->PostBackParams->Clear(); + if ($this->PostBackAction == 'FeedThis') + { + $this->PostBackParams->Set('PostBackAction', 'ProcessFeedThis'); + $ThemeFilePath = $this->Context->Configuration['EXTENSIONS_PATH'].'FeedThis/theme/Theme.FeedThisForm.php'; + include($ThemeFilePath); + } + } + } + } +?> diff --git a/extensions/FeedThis/readme.html b/extensions/FeedThis/readme.html new file mode 100644 index 0000000..6a48a77 --- /dev/null +++ b/extensions/FeedThis/readme.html @@ -0,0 +1,42 @@ +=================================== +EXTENSION INSTALLATION INSTRUCTIONS +=================================== + +In order for Vanilla to recognize an extension, it must be contained within its +own directory within the extensions directory. So, once you have downloaded and +unzipped the extension files, you can then place the folder containing the +default.php file into your installation of Vanilla. The path to your extension's +default.php file should look like this: + +/path/to/vanilla/extensions/FeedThis/default.php + +Once this is complete, you can enable the extension through the "Manage +Extensions" form on the settings tab in Vanilla. + +=================================== + +This is a forked version of the "Feed Publisher" extension. This involves no messy configuration files, but instead there are a number preset feeds that can be configured from the settings panel. I have forked this because some people want the extra power of configuration files, and didn't feel they worked hand in hand particularly well. + +There are a small number of finetune options in finetune.php should you wish to attach stylesheets to your feeds, add support for Simple Cache, turn off either RSS2 or ATOM feeds, or have custom URLS for FeedBurner support. + +This is currently working on my sites, spodesabode.com and thinkabouttech.com, and because it is in use, I intend on maintaining the code. Please get in touch with me if you find any bugs or have feature requests. + +*Features* + + - Supports RSS2 and ATOM Feeds + - Supports authentication for private forums. + - Feeds "All Discussions", "Per Discussion", "Per Category", "Blog", "Per User Blog", "Per User Comments", "Search Results". + - Supports word count limit in feed. + - Supports persistent "All Discussions" feed on all pages. + - Supports persistent "Blog" feed on all pages. + - Supports BlogThis and TagThis + - Supports Publishing FeedBurner URLs + +=================================== + +CHANGELOG + +v1.03 - Fixed the order of "All Discussions" feed (now by activity). Fixed out-by-one bug with feed limit. Fixed possibly incompatiblity with another extension. Added option to remove sidebar links to allow just the browser to pick it up. +v1.02 - Fixed an issue with URLs in feeds not having the friendly title in. Added support for custom FeedBurner URLs. +v1.01 - Fixed error with version number. Fixed issue with private forum authentication. Fixed order of feeds. Fixed issue were those without BlogThis permissions were getting blog feeds. Fixed issue with blog feeds inside discussions getting the wrong URLs. +v1.00 - Initial Forked Release diff --git a/extensions/FeedThis/theme/Theme.FeedThisForm.php b/extensions/FeedThis/theme/Theme.FeedThisForm.php new file mode 100644 index 0000000..b808748 --- /dev/null +++ b/extensions/FeedThis/theme/Theme.FeedThisForm.php @@ -0,0 +1,68 @@ +'; +if (ForceIncomingInt('Success', 0)) echo '
'.$this->Context->GetDefinition('ChangesSaved').'
'; +echo '
+ '.$this->Context->GetDefinition("FTSettings").' + '.$this->Get_Warnings().' + '.$this->Get_PostBackForm('frmFTForm').' +
    +
  • +

    +
  • + +
  • +

    '.GetDynamicCheckBox('FT_BLOG_FEED', 1, $this->ConfigurationManager->GetSetting('FT_BLOG_FEED'), '', $this->Context->GetDefinition('BlogFeedSetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_BLOG_FEED_EVERY', 1, $this->ConfigurationManager->GetSetting('FT_BLOG_FEED_EVERY'), '', $this->Context->GetDefinition('BlogFeedEverySetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_ALLDISCUSSIONS_FEED', 1, $this->ConfigurationManager->GetSetting('FT_ALLDISCUSSIONS_FEED'), '', $this->Context->GetDefinition('AllDiscussionsFeedSetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_ALLDISCUSSIONS_FEED_EVERY', 1, $this->ConfigurationManager->GetSetting('FT_ALLDISCUSSIONS_FEED_EVERY'), '', $this->Context->GetDefinition('AllDiscussionsFeedEverySetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_DISCUSSION_FEED', 1, $this->ConfigurationManager->GetSetting('FT_DISCUSSION_FEED'), '', $this->Context->GetDefinition('DiscussionFeedSetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_CATEGORY_FEED', 1, $this->ConfigurationManager->GetSetting('FT_CATEGORY_FEED'), '', $this->Context->GetDefinition('CategoryFeedSetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_SEARCHRESULTS_FEED', 1, $this->ConfigurationManager->GetSetting('FT_SEARCHRESULTS_FEED'), '', $this->Context->GetDefinition('SearchResultsFeedSetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_USERBLOG_FEED', 1, $this->ConfigurationManager->GetSetting('FT_USERBLOG_FEED'), '', $this->Context->GetDefinition('UserBlogFeedSetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_USERCOMMENTS_FEED', 1, $this->ConfigurationManager->GetSetting('FT_USERCOMMENTS_FEED'), '', $this->Context->GetDefinition('UserCommentsFeedSetting')).'

    +
  • +
  • +

    '.GetDynamicCheckBox('FT_NOSIDEBAR', 1, $this->ConfigurationManager->GetSetting('FT_NOSIDEBAR'), '', $this->Context->GetDefinition('NoSideBarFeedSetting')).'

    +
  • + +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • + +
  • +
  • +
+ + +
+'; + +?> -- 2.11.4.GIT