From b67fefb3fc9a900cfaf480b80893994b6c3c0efc Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 16 Oct 2020 13:27:43 -0400 Subject: [PATCH] 2020-10-16 Fred Gleason * Removed 'rdcastmanager.cgi'. Signed-off-by: Fred Gleason --- ChangeLog | 2 + configure.ac | 1 - rivendell.spec.in | 1 - web/Makefile.am | 3 +- web/rdcastmanager/Makefile.am | 56 - web/rdcastmanager/rdcastmanager.cpp | 1914 --------------------------- web/rdcastmanager/rdcastmanager.h | 91 -- web/rdcastmanager/rdcastmanager.js | 37 - web/rdcastmanager/rdcastmanager.pro | 0 9 files changed, 3 insertions(+), 2102 deletions(-) delete mode 100644 web/rdcastmanager/Makefile.am delete mode 100644 web/rdcastmanager/rdcastmanager.cpp delete mode 100644 web/rdcastmanager/rdcastmanager.h delete mode 100644 web/rdcastmanager/rdcastmanager.js delete mode 100644 web/rdcastmanager/rdcastmanager.pro diff --git a/ChangeLog b/ChangeLog index c0b765ee..05f7c3c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20479,3 +20479,5 @@ 2020-10-16 Fred Gleason * Modified the 'WebGet' service to supply a sane default filename for downloaded content. +2020-10-16 Fred Gleason + * Removed 'rdcastmanager.cgi'. diff --git a/configure.ac b/configure.ac index 8dde9523..52a17988 100644 --- a/configure.ac +++ b/configure.ac @@ -526,7 +526,6 @@ AC_CONFIG_FILES([rivendell.spec \ rdhpi/Makefile \ cae/Makefile \ web/Makefile \ - web/rdcastmanager/Makefile \ web/rdxport/Makefile \ web/tests/Makefile \ web/webget/Makefile \ diff --git a/rivendell.spec.in b/rivendell.spec.in index fcb82244..3437a7cb 100644 --- a/rivendell.spec.in +++ b/rivendell.spec.in @@ -380,7 +380,6 @@ rm -rf $RPM_BUILD_ROOT @libexecdir@/*.html @libexecdir@/*.js @libexecdir@/*.png -@libexecdir@/rdcastmanager.cgi %attr(6755,root,root) @libexecdir@/rdxport.cgi %attr(6755,root,root) @libexecdir@/webget.cgi @sysconfdir@/rd-bin.conf diff --git a/web/Makefile.am b/web/Makefile.am index 1a29eef3..e51250b5 100644 --- a/web/Makefile.am +++ b/web/Makefile.am @@ -20,8 +20,7 @@ ## ## Use automake to process this into a Makefile.in -SUBDIRS = rdcastmanager\ - rdxport\ +SUBDIRS = rdxport\ tests\ webget diff --git a/web/rdcastmanager/Makefile.am b/web/rdcastmanager/Makefile.am deleted file mode 100644 index 4c8af273..00000000 --- a/web/rdcastmanager/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -## Makefile.am -## -## (C) Copyright 2002-2020 Fred Gleason -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License version 2 as -## published by the Free Software Foundation. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public -## License along with this program; if not, write to the Free Software -## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## Use automake to process this into a Makefile.in - -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support -LIBS = -L$(top_srcdir)/lib -MOC = @QT_MOC@ - -# The dependency for qt's Meta Object Compiler (moc) -moc_%.cpp: %.h - $(MOC) $< -o $@ - -install-exec-am: - mkdir -p $(DESTDIR)/$(libexecdir) - cp .libs/rdcastmanager.cgi $(DESTDIR)$(libexecdir)/ - cat rdcastmanager.js | $(top_srcdir)/helpers/jsmin > $(DESTDIR)$(libexecdir)/rdcastmanager.js - -uninstall-local: - rm -f $(DESTDIR)/$(libexecdir)/rdcastmanager.cgi - rm -f $(DESTDIR)/$(libexecdir)/rdcastmanager.js - -libexec_PROGRAMS = rdcastmanager.cgi - -dist_rdcastmanager_cgi_SOURCES = rdcastmanager.cpp rdcastmanager.h - -rdcastmanager_cgi_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support - -EXTRA_DIST = rdcastmanager.js\ - rdcastmanager.pro - -CLEANFILES = *~\ - *.idb\ - *ilk\ - *.obj\ - *.pdb\ - *.qm\ - moc_* - -MAINTAINERCLEANFILES = *~\ - Makefile.in\ - moc_* diff --git a/web/rdcastmanager/rdcastmanager.cpp b/web/rdcastmanager/rdcastmanager.cpp deleted file mode 100644 index 021f0f49..00000000 --- a/web/rdcastmanager/rdcastmanager.cpp +++ /dev/null @@ -1,1914 +0,0 @@ -// rdcastmanager.cpp -// -// An RSS Feed Generator for Rivendell. -// -// (C) Copyright 2002-2009,2016-2018 Fred Gleason -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 2 as -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rdcastmanager.h" - -char server_name[PATH_MAX]; - -MainObject::MainObject(QObject *parent) - :QObject(parent) -{ - QString err_msg; - - // - // Initialize Variables - // - cast_session_id=-1; - cast_feed_id=-1; - cast_cast_id=-1; - cast_add_priv=false; - cast_edit_priv=false; - cast_delete_priv=false; - cast_post=NULL; - - // - // Open the Database - // - rda=new RDApplication("rdcastmanager.cgi","rdcastmanager.cgi",RDCASTMANAGER_CGI_USAGE,this); - if(!rda->open(&err_msg)) { - printf("Content-type: text/html\n"); - printf("Status: 500\n"); - printf("\n"); - printf("rdcastmanager.cgi: %s\n",(const char *)err_msg.utf8()); - Exit(0); - } - - // - // Read Command Options - // - for(unsigned i=0;icmdSwitch()->keys();i++) { - if(!rda->cmdSwitch()->processed(i)) { - printf("Content-type: text/html\n"); - printf("Status: 500\n"); - printf("\n"); - printf("rdcastmanager.cgi: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i).utf8()); - Exit(0); - } - } - - // - // Determine Connection Type - // - if(getenv("REQUEST_METHOD")==NULL) { - printf("Content-type: text/html\n\n"); - printf("rdcastmanager: missing REQUEST_METHOD\n"); - Exit(0); - } - if(QString(getenv("REQUEST_METHOD")).lower()!="post") { - ServeLogin(); - Exit(0); - } - - // - // Get the Server Name - // - if(getenv("SERVER_NAME")==NULL) { - printf("Content-type: text/html\n\n"); - printf("rdfeed: missing SERVER_NAME\n"); - exit(0); - } - strncpy(server_name,getenv("SERVER_NAME"),PATH_MAX); - - // - // Read Post Variables and Dispatch - // - RDSystem *system=new RDSystem(); - cast_post= - new RDFormPost(RDFormPost::MultipartEncoded,system->maxPostLength()); - delete system; - if(cast_post->error()!=RDFormPost::ErrorOk) { - RDCgiError(cast_post->errorString(cast_post->error())); - Exit(0); - } - switch(AuthenticatePost()) { - case RDCASTMANAGER_COMMAND_LOGIN: - ServeLogin(); - break; - - case RDCASTMANAGER_COMMAND_LOGOUT: - ServeLogout(); - break; - - case RDCASTMANAGER_COMMAND_LIST_FEEDS: - ServeListFeeds(); - break; - - case RDCASTMANAGER_COMMAND_LIST_CASTS: - ServeListCasts(); - break; - - case RDCASTMANAGER_COMMAND_EDIT_CAST: - ServeEditCast(); - break; - - case RDCASTMANAGER_COMMAND_COMMIT_CAST: - CommitCast(); - break; - - case RDCASTMANAGER_COMMAND_CONFIRM_DELETE_CAST: - ConfirmDeleteCast(); - break; - - case RDCASTMANAGER_COMMAND_DELETE_CAST: - DeleteCast(); - break; - - case RDCASTMANAGER_COMMAND_SUBSCRIPTION_PICK_DATES: - ServeDatePicker(RDCASTMANAGER_COMMAND_SUBSCRIPTION_REPORT); - break; - - case RDCASTMANAGER_COMMAND_SUBSCRIPTION_REPORT: - ServeSubscriptionReport(); - break; - - case RDCASTMANAGER_COMMAND_EPISODE_PICK_DATES: - ServeDatePicker(RDCASTMANAGER_COMMAND_EPISODE_REPORT); - break; - - case RDCASTMANAGER_COMMAND_EPISODE_REPORT: - ServeEpisodeReport(); - break; - - case RDCASTMANAGER_COMMAND_PLAY_CAST: - ServePlay(); - break; - - case RDCASTMANAGER_COMMAND_POST_EPISODE: - PostEpisode(); - break; - - default: - RDCgiError("Invalid post data!"); - break; - } - - Exit(0); -} - - -int MainObject::AuthenticatePost() -{ - int cmd=0; - QString password; - - // - // Check for Command Value - // - if(!cast_post->getValue("COMMAND",&cmd)) { - return RDCASTMANAGER_COMMAND_LOGIN; - } - - // - // Validate Remote Address - // - if(getenv("REMOTE_ADDR")==NULL) { - RDCgiError("Invalid CGI request!"); - Exit(0); - } - cast_client_addr.setAddress(getenv("REMOTE_ADDR")); - if(cast_client_addr.isNull()) { - RDCgiError("Invalid client IP address!"); - Exit(0); - } - - // - // Authenticate New Login - // - if(!cast_post->getValue("SESSION_ID",&cast_session_id)) { - if(!cast_post->getValue("LOGIN_NAME",&cast_login_name)) { - return RDCASTMANAGER_COMMAND_LOGIN; - } - if(!cast_post->getValue("PASSWORD",&password)) { - return RDCASTMANAGER_COMMAND_LOGIN; - } - if((cast_session_id= - RDAuthenticateLogin(cast_login_name,password,cast_client_addr))<0) { - return RDCASTMANAGER_COMMAND_LOGIN; - } - GetContext(); - return cmd; - } - - // - // Authenticate Existing Session - // - cast_login_name=RDAuthenticateSession(cast_session_id,cast_client_addr); - if(cast_login_name.isEmpty()) { - return RDCASTMANAGER_COMMAND_LOGIN; - } - GetContext(); - - return cmd; -} - - -void MainObject::ServeLogin() -{ - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Login\n"); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - printf("\n"); - printf("\n"); - printf("", - RDCASTMANAGER_COMMAND_LIST_FEEDS); - - printf("\n"); - printf("\n"); - printf("\n"); - - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - - printf("\n"); - printf("\n"); - printf("\n"); - - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - printf("\n"); - printf("
RDCastManager Login
Login Name:
Password:
 
 
\n"); - printf("\n"); - printf("\n"); - Exit(0); -} - - -void MainObject::ServeLogout() -{ - RDLogoutSession(cast_session_id,cast_client_addr); - ServeLogin(); -} - - -void MainObject::ServeListFeeds() -{ - QString sql; - RDSqlQuery *q; - RDSqlQuery *q1; - int total=0; - int active=0; - - cast_key_name=""; - cast_feed_id=-1; - cast_cast_id=-1; - - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Feed List\n"); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - printf("\n"); - - // - // Title Section - // - TitleSection("Available Feeds",RDCASTMANAGER_COMMAND_LIST_FEEDS,3); - - // - // Column Headers - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - // - // Data Rows - // - QString line_colors[2]; - line_colors[0]=RD_WEB_LINE_COLOR1; - line_colors[1]=RD_WEB_LINE_COLOR2; - int current_color=0; - - sql=QString("select ")+ - "FEED_PERMS.KEY_NAME "+ // 00 - "from FEED_PERMS left join WEB_CONNECTIONS "+ - "on(FEED_PERMS.USER_NAME=WEB_CONNECTIONS.LOGIN_NAME) where "+ - QString().sprintf("WEB_CONNECTIONS.SESSION_ID=%ld",cast_session_id); - q=new RDSqlQuery(sql); - sql=QString("select ")+ - "ID,"+ // 00 - "KEY_NAME,"+ // 01 - "CHANNEL_TITLE "+ // 02 - "from FEEDS where "; - while(q->next()) { - sql+=QString("(KEY_NAME=\"")+RDEscapeString(q->value(0).toString())+"\")||"; - } - delete q; - if(sql.right(2)=="||") { - sql=sql.left(sql.length()-2); - sql+=" order by KEY_NAME"; - q=new RDSqlQuery(sql); - while(q->next()) { - total=0; - active=0; - printf("\n"); - sql=QString("select STATUS from PODCASTS where ")+ - QString().sprintf("FEED_ID=%u",q->value(0).toUInt()); - q1=new RDSqlQuery(sql); - while(q1->next()) { - total++; - switch((RDPodcast::Status)q1->value(0).toUInt()) { - case RDPodcast::StatusActive: - case RDPodcast::StatusExpired: - active++; - break; - - case RDPodcast::StatusPending: - break; - } - } - delete q1; - if(active==total) { - printf("\n",(const char *)line_colors[current_color]); - } - else { - printf("\n", - (const char *)line_colors[current_color]); - } - printf("\n" - ,(const char *)line_colors[current_color], - (const char *)q->value(1).toString().utf8()); - printf("\n", - (const char *)line_colors[current_color], - (const char *)q->value(2).toString().utf8()); - printf("\n", - (const char *)line_colors[current_color],active,total); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - if(current_color==0) { - current_color=1; - } - else { - current_color=0; - } - } - delete q; - } - - // - // Logout Button - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - printf("
 KEY NAMEFEED NAMECASTS 
%s%s%d / %d
\n",(const char *)line_colors[current_color]); - SetContext(RDCASTMANAGER_COMMAND_LIST_CASTS); - printf("\n", - q->value(0).toInt()); - printf("\n", - (const char *)q->value(1).toString().utf8()); - printf("\n"); - printf("
 
 \n"); - printf("\n", - RDCASTMANAGER_COMMAND_LOGOUT); - printf("\n", - cast_session_id); - printf("\n"); - printf("
\n"); - printf("\n"); - printf("\n"); - Exit(0); -} - - -void MainObject::ServeListCasts() -{ - QString sql; - RDSqlQuery *q; - QString filter=""; - bool unexp_only; - bool active_only; - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - cast_cast_id=-1; - - GetUserPerms(); - - cast_post->getValue("FILTER",&filter); - unexp_only=(cast_post->value("ONLY_NOT_EXPIRED").toString().lower()=="yes"); - active_only=(cast_post->value("ONLY_ACTIVE").toString().lower()=="yes"); - - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Podcasts\n"); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - - // - // Big Frame Start - // - printf("\n"); - printf("\n"); - printf("
\n"); - - printf("\n"); - - // - // Title Section - // - printf("\n"); - printf("\n",(const char *)cast_key_name.utf8()); - SetContext(RDCASTMANAGER_COMMAND_LIST_CASTS); - - // - // Filter - // - printf("\n"); - printf("\n",RD_WEB_LINE_COLOR2); - printf("\n"); - printf("\n",RD_WEB_LINE_COLOR2); - printf("\n"); - - printf("\n"); - printf("\n",RD_WEB_LINE_COLOR2); - printf("\n"); - - printf("\n"); - printf("\n"); - - printf("\n"); - printf("\n"); - - - // - // Column Headers - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - // - // Data Rows - // - QString line_colors[2]; - line_colors[0]=RD_WEB_LINE_COLOR1; - line_colors[1]=RD_WEB_LINE_COLOR2; - int current_color=0; - /* - sql=QString("select ")+ - "ID,"+ // 00 - "STATUS,"+ // 01 - "ITEM_TITLE,"+ // 02 - "ORIGIN_DATETIME,"+ // 03 - "SHELF_LIFE,"+ // 04 - "ITEM_CATEGORY,"+ // 05 - "AUDIO_TIME "+ // 06 - "from PODCASTS "+ - RDCastSearch(cast_key_name,false,filter,unexp_only,active_only)+ - " order by ORIGIN_DATETIME desc"; - */ - q=new RDSqlQuery(sql); - while(q->next()) { - printf("\n"); - switch((RDPodcast::Status)q->value(1).toUInt()) { - case RDPodcast::StatusActive: - printf("\n",(const char *)line_colors[current_color]); - break; - - case RDPodcast::StatusPending: - printf("\n",(const char *)line_colors[current_color]); - break; - - case RDPodcast::StatusExpired: - printf("\n",(const char *)line_colors[current_color]); - break; - } - printf("\n", - (const char *)line_colors[current_color], - (const char *)q->value(2).toString().utf8()); - printf("\n", - (const char *)line_colors[current_color], - (const char *)RDUtcToLocal(q->value(3).toDateTime()). - toString("hh:mm:ss MM/dd/yyyy")); - if(q->value(4).toInt()>0) { - printf("\n", - (const char *)line_colors[current_color], - (const char *)RDUtcToLocal(q->value(3).toDateTime()). - addDays(q->value(4).toInt()).toString("hh:mm:ss MM/dd/yyyy")); - } - else { - printf("\n", - (const char *)line_colors[current_color]); - } - printf("\n", - (const char *)line_colors[current_color], - (const char *)RDGetTimeLength(q->value(6).toInt(),false,false)); - printf("\n", - (const char *)line_colors[current_color], - (const char *)q->value(5).toString()); - - // - // Play Button - // - if(1==1) { - printf("\n"); - printf("\n"); - printf("\n"); - } - else { - printf("\n"); - } - - // - // Edit Button - // - if(cast_edit_priv) { - printf("\n"); - printf("\n"); - printf("\n"); - } - else { - printf("\n"); - } - - // - // Delete Button - // - if(cast_delete_priv) { - printf("\n"); - printf("\n"); - printf("\n"); - } - else { - printf("\n"); - } - printf("\n"); - if(current_color==0) { - current_color=1; - } - else { - current_color=0; - } - } - delete q; - - // - // Spacer - // - printf("\n"); - printf("\n"); - printf("\n"); - - // - // Post Episode Button - // - if(cast_add_priv) { - printf("\n"); - printf("\n"); - printf("\n"); - } - else { - printf("\n"); - } - - // - // Subscription Report Button - // - printf("\n"); - printf("\n"); - printf("\n"); - - // - // Close Button - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - printf("
%s Podcasts
 Filter:\n",RD_WEB_LINE_COLOR2); - printf("\n",(const char *)filter.utf8()); - printf("
 Show Only Nonexpired Casts:\n",RD_WEB_LINE_COLOR2); - printf("\n"); - printf("Show Only Active Casts:\n",RD_WEB_LINE_COLOR2); - printf("\n"); - printf("
 
 TITLEPOSTEDEXPIRESLENGTHCATEGORY   
%s%s%sNever%s%s
\n", - (const char *)line_colors[current_color]); - SetContext(RDCASTMANAGER_COMMAND_PLAY_CAST); - printf("\n", - q->value(0).toInt()); - printf("\n"); - printf("\n", - (const char *)line_colors[current_color]); - printf(" \n"); - printf("
\n", - (const char *)line_colors[current_color]); - SetContext(RDCASTMANAGER_COMMAND_EDIT_CAST); - printf("\n", - q->value(0).toInt()); - printf("\n"); - printf("\n", - (const char *)line_colors[current_color]); - printf(" \n"); - printf("
\n", - (const char *)line_colors[current_color]); - SetContext(RDCASTMANAGER_COMMAND_CONFIRM_DELETE_CAST); - printf("\n", - q->value(0).toInt()); - printf("\n"); - printf("\n", - (const char *)line_colors[current_color]); - printf(" \n"); - printf("
 
 
\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("
\n", - RD_WEB_LINE_COLOR1); - SetContext(RDCASTMANAGER_COMMAND_POST_EPISODE); - printf("File:"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n",RD_WEB_LINE_COLOR1); - printf("\n"); - printf("
\n"); - printf("
 
\n"); - SetContext(RDCASTMANAGER_COMMAND_SUBSCRIPTION_PICK_DATES); - printf("\n"); - printf("
\n"); - printf("\n", - cast_session_id); - printf("\n", - RDCASTMANAGER_COMMAND_LIST_FEEDS); - printf("\n"); - printf("
\n"); - - // - // Big Frame End - // - printf("
\n"); - - printf("\n"); - printf("\n"); - Exit(0); -} - - -void MainObject::ServeEditCast(int cast_id) -{ - QString sql; - RDSqlQuery *q; - - GetUserPerms(); - if(!cast_edit_priv) { - RDCgiError("Insufficient privileges for this operation!"); - Exit(0); - } - - if(cast_id<0) { - GetContext(); - if(cast_cast_id<0) { - RDCgiError("Missing CAST_ID"); - Exit(0); - } - } - else { - cast_cast_id=cast_id; - } - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - - sql=QString().sprintf("select ITEM_TITLE,ITEM_AUTHOR,\ - ITEM_CATEGORY,ITEM_LINK,ITEM_DESCRIPTION,\ - ITEM_COMMENTS,ITEM_SOURCE_TEXT,ITEM_SOURCE_URL,\ - ITEM_COMMENTS,SHELF_LIFE,ORIGIN_DATETIME,STATUS,\ - EFFECTIVE_DATETIME \ - from PODCASTS where ID=%d",cast_cast_id); - q=new RDSqlQuery(sql); - if(!q->first()) { - delete q; - RDCgiError("Unable to fetch cast record!"); - Exit(0); - } - QDateTime origin_datetime=RDUtcToLocal(q->value(10).toDateTime()); - QDateTime effective_datetime=RDUtcToLocal(q->value(12).toDateTime()); - - RDFeed *feed=new RDFeed(cast_feed_id,rda->config()); - - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Editing \"%s\"\n", - (const char *)q->value(0).toString().utf8()); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - printf("\n"); - - // - // Title Section - // - TitleSection("Editing Podcast",RDCASTMANAGER_COMMAND_EDIT_CAST,1); - - // - // Media Link - // - /* - if(feed->mediaLinkMode()!=RDFeed::LinkNone) { - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - printf("\n"); - printf("\n"); - printf("\n"); - } - */ - // - // Cast Data - // - printf("\n"); - SetContext(RDCASTMANAGER_COMMAND_COMMIT_CAST); - - // - // Title - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Author E-Mail - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Category - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Link URL - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Description - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Source Text - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Source Link - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Comments - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Origin Datetime - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - // - // Effective Date/Time - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - QDateTime exp=origin_datetime.addDays(q->value(9).toInt()); - if(q->value(11).toInt()==RDPodcast::StatusExpired) { - printf("\n", - RDPodcast::StatusExpired); - if(q->value(9).toInt()==0) { - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - } - else { - printf("\n"); - printf("\n",(const char *)exp.toString("MM")); - printf("\n", - (const char *)exp.toString("dd")); - printf("\n", - (const char *)exp.toString("yyyy")); - printf("\n", - (const char *)exp.toString("hh")); - printf("\n",(const char *)exp.toString("mm")); - printf("\n",(const char *)exp.toString("ss")); - } - } - else { - // - // Expiration - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - - if(q->value(9).toInt()==0) { - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - } - else { - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n"); - } - - // - // Posting Status - // - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("\n", - RDPodcast::StatusActive); - } - else { - printf("Hold\n", - RDPodcast::StatusPending); - printf("\n"); - printf("\n", - RDPodcast::StatusActive); - - } - printf("\n"); - printf("\n"); - } - - printf("\n"); - - // - // OK Button - // - printf("\n"); - printf("\n"); - - // - // Cancel Button - // - printf("\n"); - printf("\n"); - printf("\n"); - - // - // Episode Report Button - // - printf("\n"); - printf("\n"); - printf("\n"); - - printf("\n"); - - printf("
Media Link:\n", - RD_WEB_LINE_COLOR1); - printf("%s\n",(const char *)feed->audioUrl(feed->mediaLinkMode(), - server_name,cast_cast_id).utf8()); - printf("
 
Title:\n", - RD_WEB_LINE_COLOR1); - printf("\n",(const char *)q->value(0).toString().utf8()); - printf("
Author E-Mail:\n", - RD_WEB_LINE_COLOR1); - printf("\n",(const char *)q->value(1).toString().utf8()); - printf("
Category:\n", - RD_WEB_LINE_COLOR1); - printf("\n",(const char *)q->value(2).toString().utf8()); - printf("
Link URL:\n", - RD_WEB_LINE_COLOR1); - printf("\n",(const char *)q->value(3).toString().utf8()); - printf("
Description:\n", - RD_WEB_LINE_COLOR1); - printf("\n",(const char *)q->value(4).toString().utf8()); - printf("
Source Text:\n", - RD_WEB_LINE_COLOR1); - printf("\n", - (const char *)q->value(6).toString().utf8()); - printf("
Source Link:\n", - RD_WEB_LINE_COLOR1); - printf("\n", - (const char *)q->value(7).toString().utf8()); - printf("
Comments:\n", - RD_WEB_LINE_COLOR1); - printf("\n",(const char *)q->value(5).toString().utf8()); - printf("
Posted At:\n", - RD_WEB_LINE_COLOR1); - printf("\n", - (const char *)origin_datetime.toString("MM/dd/yyyy - hh:mm:ss")); - printf("
Air Date/Time:\n", - RD_WEB_LINE_COLOR1); - printf("/\n",effective_datetime.date().month()); - printf("/\n",effective_datetime.date().day()); - printf(" -- \n",effective_datetime.date().year()); - printf(":\n",effective_datetime.time().hour()); - printf(":\n",effective_datetime.time().minute()); - printf("\n",effective_datetime.time().second()); - printf("
Cast Expires:\n", - RD_WEB_LINE_COLOR1); - printf("\n"); - printf("
Expires At:\n", - RD_WEB_LINE_COLOR1); - printf("/\n"); - printf("/\n"); - printf(" -- \n"); - printf(":\n"); - printf(":\n"); - printf("\n"); - printf("
Expires At:\n", - RD_WEB_LINE_COLOR1); - printf("/\n",(const char *)exp.toString("MM")); - printf("/\n",(const char *)exp.toString("dd")); - printf(" -- \n",(const char *)exp.toString("yyyy")); - printf(":\n",(const char *)exp.toString("hh")); - printf(":\n",(const char *)exp.toString("mm")); - printf("\n",(const char *)exp.toString("ss")); - printf("
Posting Status:\n",RD_WEB_LINE_COLOR1); - if((q->value(11).toInt()==RDPodcast::StatusPending)) { - printf("Hold\n", - RDPodcast::StatusPending); - printf("\n",RD_WEB_LINE_COLOR1); - printf("Active\n",RD_WEB_LINE_COLOR1); - printf("Active
\n"); - printf("\n"); - printf("
\n"); - int id=cast_cast_id; // UGLY, UGLY UGLY!!! - cast_cast_id=-1; - SetContext(RDCASTMANAGER_COMMAND_LIST_CASTS); - cast_cast_id=id; - printf("\n"); - printf("
\n"); - SetContext(RDCASTMANAGER_COMMAND_EPISODE_PICK_DATES); - printf("\n"); - printf("
\n"); - printf("\n"); - printf("\n"); - - delete feed; - - Exit(0); -} - - -void MainObject::ServePlay() -{ - QString sql; - RDSqlQuery *q; - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - if(cast_cast_id<0) { - RDCgiError("Missing CAST_ID"); - Exit(0); - } - - sql=QString("select ")+ - "FEEDS.BASE_URL,"+ // 00 - "PODCASTS.AUDIO_FILENAME "+ // 01 - "from FEEDS left join PODCASTS "+ - "on FEEDS.ID=PODCASTS.FEED_ID where "+ - QString().sprintf("PODCASTS.ID=%d",cast_cast_id); - q=new RDSqlQuery(sql); - if(q->first()) { - printf("Content-type: audio/x-mpeg\n"); - printf("Location: %s/%s\n\n",(const char *)q->value(0).toString().utf8(), - (const char *)q->value(1).toString().utf8()); - } - else { - printf("Status: 500 Internal Server Error\n"); - printf("Content-type: text/html\n"); - printf("\n"); - printf("The cast ID was not found in the database.\n"); - } - delete q; -} - - -void MainObject::CommitCast() -{ - QString sql; - RDSqlQuery *q; - QString item_title; - QString item_author; - QString item_category; - QString item_link; - QString item_description; - QString item_source_text; - QString item_source_url; - QString item_comments; - QString expires; - int expiration_day=0; - int expiration_month=0; - int expiration_year=0; - int expiration_hour=0; - int expiration_minute=0; - int expiration_second=0; - int effective_day=0; - int effective_month=0; - int effective_year=0; - int effective_hour=0; - int effective_minute=0; - int effective_second=0; - unsigned shelf_life=0; - int status; - - GetUserPerms(); - if(!cast_edit_priv) { - RDCgiError("Insufficient privileges for this operation!"); - Exit(0); - } - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - if(cast_cast_id<0) { - RDCgiError("Missing CAST_ID"); - Exit(0); - } - if(!cast_post->getValue("ITEM_TITLE",&item_title)) { - RDCgiError("Missing ITEM_TITLE"); - Exit(0); - } - cast_post->getValue("ITEM_AUTHOR",&item_author); - cast_post->getValue("ITEM_CATEGORY",&item_category); - cast_post->getValue("ITEM_LINK",&item_link); - cast_post->getValue("ITEM_DESCRIPTION",&item_description); - cast_post->getValue("ITEM_SOURCE_TEXT",&item_source_text); - cast_post->getValue("ITEM_SOURCE_URL",&item_source_url); - cast_post->getValue("ITEM_COMMENTS",&item_comments); - if(!cast_post->getValue("EFFECTIVE_DAY",&effective_day)) { - RDCgiError("Missing EFFECTIVE_DAY"); - Exit(0); - } - if(!cast_post->getValue("EFFECTIVE_MONTH",&effective_month)) { - RDCgiError("Missing EFFECTIVE_MONTH"); - Exit(0); - } - if(!cast_post->getValue("EFFECTIVE_YEAR",&effective_year)) { - RDCgiError("Missing EFFECTIVE_YEAR"); - Exit(0); - } - if(!cast_post->getValue("EFFECTIVE_HOUR",&effective_hour)) { - RDCgiError("Missing EFFECTIVE_HOUR"); - Exit(0); - } - if(!cast_post->getValue("EFFECTIVE_MINUTE",&effective_minute)) { - RDCgiError("Missing EFFECTIVE_MINUTE"); - Exit(0); - } - if(!cast_post->getValue("EFFECTIVE_SECOND",&effective_second)) { - RDCgiError("Missing EFFECTIVE_SECOND"); - Exit(0); - } - if(!cast_post->getValue("EXPIRES",&expires)) { - RDCgiError("Missing EXPIRES"); - Exit(0); - } - if(expires.lower()=="yes") { - if(!cast_post->getValue("EXPIRATION_DAY",&expiration_day)) { - RDCgiError("Missing EXPIRATION_DAY"); - Exit(0); - } - if(!cast_post->getValue("EXPIRATION_MONTH",&expiration_month)) { - RDCgiError("Missing EXPIRATION_MONTH"); - Exit(0); - } - if(!cast_post->getValue("EXPIRATION_YEAR",&expiration_year)) { - RDCgiError("Missing EXPIRATION_YEAR"); - Exit(0); - } - if(!cast_post->getValue("EXPIRATION_HOUR",&expiration_hour)) { - RDCgiError("Missing EXPIRATION_HOUR"); - Exit(0); - } - if(!cast_post->getValue("EXPIRATION_MINUTE",&expiration_minute)) { - RDCgiError("Missing EXPIRATION_MINUTE"); - Exit(0); - } - if(!cast_post->getValue("EXPIRATION_SECOND",&expiration_second)) { - RDCgiError("Missing EXPIRATION_SECOND"); - Exit(0); - } - sql=QString().sprintf("select ORIGIN_DATETIME from PODCASTS \ - where ID=%d",cast_cast_id); - q=new RDSqlQuery(sql); - if(!q->first()) { - delete q; - RDCgiError("Unable to access cast record!"); - } - QDateTime dt(QDate(expiration_year,expiration_month,expiration_day), - QTime(expiration_hour,expiration_minute,expiration_second)); - if(dt.isNull()) { - RDCgiError("Invalid expiration date!"); - delete q; - Exit(0); - } - shelf_life=q->value(0).toDateTime().daysTo(dt); - delete q; - } - if(!cast_post->getValue("STATUS",&status)) { - RDCgiError("Missing STATUS"); - Exit(0); - } - QDateTime - effective_datetime(QDate(effective_year,effective_month,effective_day), - QTime(effective_hour,effective_minute,effective_second)); - sql=QString("update PODCASTS set ")+ - QString().sprintf("STATUS=%d,",status)+ - "ITEM_TITLE=\""+RDEscapeString(item_title)+"\","+ - "ITEM_DESCRIPTION=\""+RDEscapeString(item_description)+"\","+ - "ITEM_CATEGORY=\""+RDEscapeString(item_category)+"\","+ - "ITEM_LINK=\""+RDEscapeString(item_link)+"\","+ - "ITEM_COMMENTS=\""+RDEscapeString(item_comments)+"\","+ - "ITEM_AUTHOR=\""+RDEscapeString(item_author)+"\","+ - "ITEM_SOURCE_TEXT=\""+RDEscapeString(item_source_text)+"\","+ - "ITEM_SOURCE_URL=\""+RDEscapeString(item_source_url)+"\","+ - QString().sprintf("SHELF_LIFE=%d,",shelf_life)+ - "EFFECTIVE_DATETIME="+ - RDCheckDateTime(RDLocalToUtc(effective_datetime),"yyyy-MM-dd hh:mm:ss")+ - " where "+ - QString().sprintf("ID=%d",cast_cast_id); - q=new RDSqlQuery(sql); - delete q; - - sql=QString("update FEEDS set ")+ - "LAST_BUILD_DATETIME=UTC_TIMESTAMP() where "+ - QString().sprintf("ID=%d",cast_feed_id); - q=new RDSqlQuery(sql); - delete q; - - ServeListCasts(); -} - - -void MainObject::ConfirmDeleteCast() -{ - QString sql; - RDSqlQuery *q; - - GetUserPerms(); - if(!cast_delete_priv) { - RDCgiError("Insufficient privileges for this operation!"); - Exit(0); - } - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - if(cast_cast_id<0) { - RDCgiError("Missing CAST_ID"); - Exit(0); - } - - sql=QString().sprintf("select ITEM_TITLE,ORIGIN_DATETIME from PODCASTS \ - where ID=%d",cast_cast_id); - q=new RDSqlQuery(sql); - if(!q->first()) { - RDCgiError("unable to access cast record!"); - Exit(0); - } - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Confirm Delete\n"); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - printf("\n"); - printf("\n"); - printf("\n", - RD_WEB_LINE_COLOR2, - (const char *)q->value(0).toString().utf8(), - (const char *)q->value(1).toDateTime().toString("MM/dd/yyyy"), - (const char *)q->value(1).toDateTime().toString("hh:mm:ss")); - printf("\n"); - - printf("\n"); - printf("\n"); - - printf("\n"); - printf("\n"); - printf("
Are you sure you want to delete cast \"%s\", posted on %s at %s?
 
\n"); - printf("\n"); - printf("\n"); - - // - // Yes Button - // - printf("\n"); - printf("\n"); - printf("\n"); - - printf("\n"); - - // - // No Button - // - printf("\n"); - printf("\n"); - printf("\n"); - - printf("\n"); - printf("
\n"); - SetContext(RDCASTMANAGER_COMMAND_DELETE_CAST); - printf("\n"); - printf(" 
\n"); - cast_cast_id=-1; - SetContext(RDCASTMANAGER_COMMAND_LIST_CASTS); - printf("\n"); - printf("
\n"); - - printf("
\n"); -} - - -void MainObject::DeleteCast() -{ - QString sql; - RDSqlQuery *q; - QString errs; - - GetUserPerms(); - if(!cast_delete_priv) { - RDCgiError("Insufficient privileges for this operation!"); - Exit(0); - } - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - if(cast_cast_id<0) { - RDCgiError("Missing CAST_ID"); - Exit(0); - } - - RDFeed *feed=new RDFeed(cast_feed_id,rda->config()); - RDPodcast *cast=new RDPodcast(rda->config(),cast_cast_id); - cast->dropAudio(feed,&errs,rda->config()->logXloadDebugData()); - delete cast; - delete feed; - - sql=QString().sprintf("delete from PODCASTS where ID=%d",cast_cast_id); - q=new RDSqlQuery(sql); - delete q; - - ServeListCasts(); -} - - -void MainObject::ServeSubscriptionReport() -{ - QString sql; - RDSqlQuery *q; - unsigned rss_total=0; - unsigned audio_total=0; - unsigned total=0; - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - cast_cast_id=-1; - RDFeed *feed=new RDFeed(cast_key_name,rda->config(),this); - - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Subscription Report\n"); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - printf("\n"); - - // - // Title Section - // - printf("\n"); - printf("\n"); - - // - // Column Headers - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - - // - // Data Rows - // - QString line_colors[2]; - line_colors[0]=RD_WEB_LINE_COLOR1; - line_colors[1]=RD_WEB_LINE_COLOR2; - int current_color=0; - sql=QString("select ")+ - "ACCESS_DATE,"+ // 00 - "ACCESS_COUNT,"+ // 01 - "CAST_ID "+ // 02 - "from CAST_DOWNLOADS where "+ - "(ACCESS_DATE>=\""+ - RDEscapeString(cast_start_date.toString("yyyy-MM-dd"))+"\")&&"+ - "(ACCESS_DATE<=\""+ - RDEscapeString(cast_end_date.toString("yyyy-MM-dd"))+"\" "+ - "order by ACCESS_DATE,CAST_ID desc"; - q=new RDSqlQuery(sql); - while(q->next()) { - if(q->value(2).toUInt()==0) { - printf("\n", - (const char *)line_colors[current_color], - (const char *)q->value(0).toDate(). - toString("MM/dd/yyyy")); - printf("\n", - (const char *)line_colors[current_color], - q->value(1).toUInt()); - printf("\n", - (const char *)line_colors[current_color], - total); - total=0; - rss_total+=q->value(1).toUInt(); - if(current_color==0) { - current_color=1; - } - else { - current_color=0; - } - } - else { - total+=q->value(1).toUInt(); - audio_total+=q->value(1).toUInt(); - } - } - printf("\n"); - printf("\n",rss_total); - printf("\n",audio_total); - delete q; - - delete feed; - - // - // Close Button - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - printf("
\n"); - printf("Subscription Report for \"%s\"\n", - (const char *)feed->channelTitle().utf8()); - printf("
DATERSSAUDIO
%s%9u%9u
TOTAL%9u%9u
 
  \n"); - SetContext(RDCASTMANAGER_COMMAND_LIST_CASTS); - printf("\n"); - printf("
\n"); - printf("\n"); - printf("\n"); - Exit(0); -} - - -void MainObject::PostEpisode() -{ - /* - QString media_file; - - GetContext(); - GetUserPerms(); - if(!cast_add_priv) { - RDCgiError("Insufficient privileges for this operation!"); - Exit(0); - } - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - if(!cast_post->getValue("MEDIA_FILE",&media_file)) { - RDCgiError("Missing MEDIA_FILE"); - Exit(0); - } - if(!cast_post->isFile("MEDIA_FILE")) { - RDCgiError("No MEDIA_FILE submitted!"); - Exit(0); - } - RDStation *station=new RDStation(rda->config()->stationName(),0); - if(!station->exists()) { - RDCgiError("Server station entry not found!"); - Exit(0); - } - RDFeed::Error err; - RDFeed *feed=new RDFeed(cast_feed_id,rda->config(),this); - int cast_id=feed->postFile(station,media_file,&err, - rda->config()->logXloadDebugData(),rda->config()); - delete feed; - delete station; - if(err!=RDFeed::ErrorOk) { - RDCgiError(RDFeed::errorString(err)); - Exit(0); - } - ServeEditCast(cast_id); - */ - Exit(0); -} - - -void MainObject::ServeEpisodeReport() -{ - QString sql; - RDSqlQuery *q; - unsigned total=0; - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - if(cast_cast_id<0) { - RDCgiError("Missing CAST_ID"); - Exit(0); - } - RDPodcast *cast=new RDPodcast(rda->config(),cast_cast_id); - - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Episode Report\n"); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - printf("\n"); - - // - // Title Section - // - printf("\n"); - printf("\n"); - - // - // Column Headers - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - - // - // Data Rows - // - QString line_colors[2]; - line_colors[0]=RD_WEB_LINE_COLOR1; - line_colors[1]=RD_WEB_LINE_COLOR2; - int current_color=0; - sql=QString("select ")+ - "ACCESS_DATE,"+ // 00 - "ACCESS_COUNT "+ // 01 - "from CAST_DOWNLOADS where "+ - "FEED_KEY_NAME=\""+RDEscapeString(cast_key_name)+"\" && "+ - "(ACCESS_DATE>=\""+ - RDEscapeString(cast_start_date.toString("yyyy-MM-dd"))+"\")&&"+ - "(ACCESS_DATE<=\""+ - RDEscapeString(cast_end_date.toString("yyyy-MM-dd"))+"\")&&"+ - QString().sprintf("(CAST_ID=%d) ",cast_cast_id)+ - "order by ACCESS_DATE"; - q=new RDSqlQuery(sql); - while(q->next()) { - printf("\n", - (const char *)line_colors[current_color], - (const char *)q->value(0).toDate(). - toString("MM/dd/yyyy")); - printf("\n", - (const char *)line_colors[current_color], - q->value(1).toUInt()); - if(current_color==0) { - current_color=1; - } - else { - current_color=0; - } - total+=q->value(1).toUInt(); - } - printf("\n"); - printf("\n",total); - delete q; - - delete cast; - - // - // Close Button - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - printf("
\n"); - printf("Episode Report for \"%s\"\n", - (const char *)cast->itemTitle()); - printf("
DATEDOWNLOADS
%s%9u
TOTAL%9u
 
 \n"); - SetContext(RDCASTMANAGER_COMMAND_EDIT_CAST); - printf("\n"); - printf("
\n"); - printf("\n"); - printf("\n"); - Exit(0); -} - - -void MainObject::ServeDatePicker(int cmd) -{ - QDate yesterday_date=QDate::currentDate().addDays(-1); - - GetContext(); - if(cast_key_name.isEmpty()) { - RDCgiError("Missing KEY_NAME"); - Exit(0); - } - if(cast_feed_id<0) { - RDCgiError("Missing FEED_ID"); - Exit(0); - } - - printf("Content-type: text/html\n\n"); - printf("\n"); - printf("\n"); - printf("Rivendell RDCastManager -- Choose Dates\n"); - printf("\n"); - - printf("\n",RD_WEB_BACKGROUND_COLOR); - printf("\n"); - - printf("
\n"); - - printf("\n"); - printf("\n"); - printf("\n"); - - // - // Start Date - // - printf("\n"); - printf("\n"); - printf("\n"); - SetContext(cmd); - printf("\n",(const char *)yesterday_date.addMonths(-1).toString("yyyy")); - printf("\n"); - - // - // End Date - // - printf("\n"); - printf("\n"); - printf("\n",(const char *)yesterday_date.toString("yyyy")); - printf("\n"); - - // - // Next Button - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - - printf("
SELECT DATES
Start Date:
/\n",(const char *)yesterday_date.addMonths(-1).toString("MM")); - printf("/\n",(const char *)yesterday_date.addMonths(-1).toString("dd")); - printf("
End Date:/\n",(const char *)yesterday_date.toString("MM")); - printf("/\n",(const char *)yesterday_date.toString("dd")); - printf("
\n"); - printf("
\n"); - printf("\n"); - printf("\n"); - Exit(0); -} - - -void MainObject::TitleSection(const QString &title,int cmd,int colspan) const -{ - printf("\n"); - printf(" \n"); - printf("%s\n", - colspan,(const char *)title.utf8()); - printf("\n"); - // - // Refresh Button - // - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("\n"); - printf("
\n"); - SetContext(cmd); - printf("\n"); - printf("
\n"); - printf("\n"); -} - - -void MainObject::GetUserPerms() -{ - QString sql; - RDSqlQuery *q; - - sql=QString().sprintf("select USERS.ADD_PODCAST_PRIV,\ - USERS.EDIT_PODCAST_PRIV,USERS.DELETE_PODCAST_PRIV \ - from USERS left join WEB_CONNECTIONS \ - on USERS.LOGIN_NAME=WEB_CONNECTIONS.LOGIN_NAME \ - where WEB_CONNECTIONS.SESSION_ID=%ld", - cast_session_id); - q=new RDSqlQuery(sql); - if(!q->first()) { - delete q; - RDCgiError("Unable to load user security settings!"); - Exit(0); - } - cast_add_priv=RDBool(q->value(0).toString()); - cast_edit_priv=RDBool(q->value(1).toString()); - cast_delete_priv=RDBool(q->value(2).toString()); - delete q; -} - - -void MainObject::GetContext() -{ - int day=0; - int month=0; - int year=0; - - // - // Basic Context - // - cast_post->getValue("KEY_NAME",&cast_key_name); - cast_post->getValue("FEED_ID",&cast_feed_id); - cast_post->getValue("CAST_ID",&cast_cast_id); - - // - // Start Date - // - cast_post->getValue("START_DAY",&day); - cast_post->getValue("START_MONTH",&month); - cast_post->getValue("START_YEAR",&year); - cast_start_date=QDate(year,month,day); - - // - // End Date - // - day=0; - month=0; - year=0; - cast_post->getValue("END_DAY",&day); - cast_post->getValue("END_MONTH",&month); - cast_post->getValue("END_YEAR",&year); - cast_end_date=QDate(year,month,day); -} - - -void MainObject::SetContext(int cmd) const -{ - printf("\n", - cmd); - printf("\n", - cast_session_id); - if(!cast_key_name.isEmpty()) { - printf("\n", - (const char *)cast_key_name.utf8()); - } - if(cast_feed_id>=0) { - printf("\n", - cast_feed_id); - } - if(cast_cast_id>=0) { - printf("\n", - cast_cast_id); - } -} - - -void MainObject::Exit(int code) -{ - if(cast_post!=NULL) { - delete cast_post; - } - exit(code); -} - - -int main(int argc,char *argv[]) -{ - QApplication a(argc,argv,false); - new MainObject(); - return a.exec(); -} diff --git a/web/rdcastmanager/rdcastmanager.h b/web/rdcastmanager/rdcastmanager.h deleted file mode 100644 index 9c5d8a18..00000000 --- a/web/rdcastmanager/rdcastmanager.h +++ /dev/null @@ -1,91 +0,0 @@ -// rdcastmanager.h -// -// Web-Based RSS Podcast Manager for Rivendell. -// -// (C) Copyright 2002-2007,2016-2018 Fred Gleason -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 2 as -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#ifndef RDCASTMANAGER_H -#define RDCASTMANAGER_H - -#include -#include - -#include - -#define RDCASTMANAGER_CGI_USAGE "\n" - -// -// CGI Values -// -#define RDCASTMANAGER_POST_SIZE 4096 -#define RDCASTMANAGER_MAX_FILTER_LENGTH 256 -#define RDCASTMANAGER_COMMAND_LOGIN 0 -#define RDCASTMANAGER_COMMAND_LOGOUT 1 -#define RDCASTMANAGER_COMMAND_LIST_FEEDS 2 -#define RDCASTMANAGER_COMMAND_LIST_CASTS 3 -#define RDCASTMANAGER_COMMAND_EDIT_CAST 4 -#define RDCASTMANAGER_COMMAND_COMMIT_CAST 5 -#define RDCASTMANAGER_COMMAND_CONFIRM_DELETE_CAST 6 -#define RDCASTMANAGER_COMMAND_DELETE_CAST 7 -#define RDCASTMANAGER_COMMAND_SUBSCRIPTION_PICK_DATES 8 -#define RDCASTMANAGER_COMMAND_SUBSCRIPTION_REPORT 9 -#define RDCASTMANAGER_COMMAND_EPISODE_PICK_DATES 10 -#define RDCASTMANAGER_COMMAND_EPISODE_REPORT 11 -#define RDCASTMANAGER_COMMAND_PLAY_CAST 12 -#define RDCASTMANAGER_COMMAND_POST_EPISODE 13 - -class MainObject : public QObject -{ - public: - MainObject(QObject *parent=0); - - private: - int AuthenticatePost(); - void ServeLogin(); - void ServeLogout(); - void ServeListFeeds(); - void ServeListCasts(); - void ServeEditCast(int cast_id=-1); - void ServePlay(); - void CommitCast(); - void ConfirmDeleteCast(); - void DeleteCast(); - void ServeSubscriptionReport(); - void ServeEpisodeReport(); - void PostEpisode(); - void ServeDatePicker(int cmd); - void TitleSection(const QString &title,int cmd,int colspan) const; - void GetUserPerms(); - void GetContext(); - void SetContext(int cmd) const; - void Exit(int code); - RDFormPost *cast_post; - QString cast_login_name; - long int cast_session_id; - QHostAddress cast_client_addr; - QString cast_key_name; - int cast_feed_id; - int cast_cast_id; - bool cast_add_priv; - bool cast_edit_priv; - bool cast_delete_priv; - QDate cast_start_date; - QDate cast_end_date; -}; - - -#endif // RDCASTMANAGER_H diff --git a/web/rdcastmanager/rdcastmanager.js b/web/rdcastmanager/rdcastmanager.js deleted file mode 100644 index b730d4a6..00000000 --- a/web/rdcastmanager/rdcastmanager.js +++ /dev/null @@ -1,37 +0,0 @@ -// rdcastmanager.js -// -// Script for displaying an upload progress dialog in a web browser. -// -// (C) Copyright 2009,2016 Fred Gleason -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 2 as -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -function StartProgressbar() -{ - var html='\n'+ - ''+ - '\n'+ - '\n'+ - '
\n'+ - 'File uploading, please stand by...
\n'+ - '
\n'; - - document.getElementById("bigframe").innerHTML=html; -} - -function PostCast() -{ - window.setTimeout('StartProgressbar()',10); -} diff --git a/web/rdcastmanager/rdcastmanager.pro b/web/rdcastmanager/rdcastmanager.pro deleted file mode 100644 index e69de29b..00000000