Notifications
Clear all

[MODULE] ePubVersion

123 Posts
21 Users
0 Reactions
50.4 K Views
(@banshee)
Posts: 92
Member Admin
 

Yay, thanks for this!


eFiction Archives: Tom Paris Dorm | Twice Bitten | Underground

 
Posted : 01/07/2014 7:29 pm
 SJP
(@sjp)
Posts: 66
Trusted Member
 

YAY, it's working!

Now I have another question: how can I remove the ePub icon and use a text link instead?

Glad I could help, Nadia and banshee.

If you want to remove the icon and use a text link, go to modules/epubversion/storyblock.php. You'll see

if($epubrw == "1") {
if(!empty($chapter) && $chapters > 1) $printepub = "<img src="'".(isset($epubicon)" ? $epubicon : $icon)."' border='0' alt='"._EPUB."'> <a href=""modules/epubversion/epubs/$sid/$chapter/$title_san.epub"" title="Download ePub File">"._CHAPTER."</a> "._OR." <a href=""modules/epubversion/epubs/$sid/all/$title_san.epub"" title="Download ePub File">"._STORY."</a>";
else $printepub = "<a href=""modules/epubversion/epubs/$sid/all/$title_san.epub"" title="Download ePub File"><img src="'".(isset($epubicon)" ? $epubicon :  $icon)."' border='0' alt='"._EPUB."'></a>";
}
else {
if(!empty($chapter) && $chapters > 1) $printepub = "<img src="'".(isset($epubicon)" ? $epubicon : $icon)."' border='0' alt='"._EPUB."'> <a href=""modules/epubversion/epubversion.php?sid=$sid&amp;chapter=$chapter"" title="Download ePub File">"._CHAPTER."</a> "._OR." <a href=""modules/epubversion/epubversion.php?sid=$sid&amp;chapter=all"" title="Download ePub File">"._STORY."</a>";
else $printepub = "<a href=""modules/epubversion/epubversion.php?sid=$sid&amp;chapter=all"" title="Download ePub File"><img src="'".(isset($epubicon)" ? $epubicon :  $icon)."' border='0' alt='"._EPUB."'></a>";

This controls the download link. The first section is if you use modrewrite for the links. If you're not sure if you want to use modrewrite or not (I don't since it can throw errors if the story title has certain characters or punctuation in it), you can modify both. However, here's what it would look like if you just modified the version that doesn't use modrewrite

if($epubrw == "1") {
if(!empty($chapter) && $chapters > 1) $printepub = "<img src="'".(isset($epubicon)" ? $epubicon : $icon)."' border='0' alt='"._EPUB."'> <a href=""modules/epubversion/epubs/$sid/$chapter/$title_san.epub"" title="Download ePub File">"._CHAPTER."</a> "._OR." <a href=""modules/epubversion/epubs/$sid/all/$title_san.epub"" title="Download ePub File">"._STORY."</a>";
else $printepub = "<a href=""modules/epubversion/epubs/$sid/all/$title_san.epub"" title="Download ePub File"><img src="'".(isset($epubicon)" ? $epubicon :  $icon)."' border='0' alt='"._EPUB."'></a>";
}
else {
if(!empty($chapter) && $chapters > 1) $printepub = "<a href=""modules/epubversion/epubversion.php?sid=$sid&amp;chapter=$chapter"" title="Download ePub File">Download Chapter ePub</a> "._OR." <a href=""modules/epubversion/epubversion.php?sid=$sid&amp;chapter=all"" title="Download ePub File">Download Story ePub</a>";
else $printepub = "<a href=""modules/epubversion/epubversion.php?sid=$sid&amp;chapter=all"" title="Download ePub File">Download Story ePub</a>";

I just wrote Download Chapter ePub and Download Story ePub as an example, you can make the text whatever you want 🙂 .


 
Posted : 01/07/2014 10:51 pm
Nadia
(@nadia)
Posts: 255
Reputable Member
 

Thanks again! That's awesome!

And I do have another prob. Within the epubs there are no German umlauts. Meaning no ä ö or ü which is a big problem. Is there any way to change the utf or whatever to make it compatible with German? Otherwise I can't use the module because the text is full of ? instead of the umlauts.  :sad1:


My Hub TrekNation | World of X | Arda Fanfiction

 
Posted : 07/07/2014 5:03 pm
 SJP
(@sjp)
Posts: 66
Trusted Member
 

Thanks again! That's awesome!

And I do have another prob. Within the epubs there are no German umlauts. Meaning no ä ö or ü which is a big problem. Is there any way to change the utf or whatever to make it compatible with German? Otherwise I can't use the module because the text is full of ? instead of the umlauts.  :sad1:

I never noticed this issue since I don't deal with umlauts all that often 🙂 . To test it, I just shoved some German text into a story on my test site, and when I went to download the ePub, the letters with umlauts showed up just fine in the story text. Since I'm not having the same problem, and I can't test it, I'm not sure what to tell you. I'm sorry I can't be more help.


 
Posted : 09/07/2014 3:43 pm
(@sheepcontrol)
Posts: 332
Reputable Member
 

Thanks again! That's awesome!

And I do have another prob. Within the epubs there are no German umlauts. Meaning no ä ö or ü which is a big problem. Is there any way to change the utf or whatever to make it compatible with German? Otherwise I can't use the module because the text is full of ? instead of the umlauts.  :sad1:

Might be UTF-8 to ISO codepage shizzles, darn them for inventing a million codepages in the first place :/ Will look into it.


 
Posted : 09/07/2014 5:35 pm
(@piper)
Posts: 91
Trusted Member
Topic starter
 

Just an FYI, I have migrated my private SVN to a public GitHib https://github.com/geekbrat/ePubVersion


StoryPortal Fiction Network - StoryPortal.Net
TG Fiction dot NET | T* Fiction Archive - TGFiction.Net
LG Tales | TG Style Fiction for LG's - LGTales.Com

 
Posted : 25/02/2016 2:25 pm
(@guest15229)
Posts: 0
 

I just did a fresh install of Efiction, followed by an install of this module. Everything went fine until I tried downloading an EPUB. It gave me a bunch of errors, most of which had to do with the time/date. I edited all of those instances out of the PHP files, which solved that issue, but I'm still having trouble with these:

Notice: Array to string conversion in /homepages/5/d609431004/htdocs/whimsicalwanderings/writing/modules/epubversion/epubversion.php on line 162

Notice: Undefined variable: img_filename in /homepages/5/d609431004/htdocs/whimsicalwanderings/writing/modules/epubversion/cover_img.php on line 90

Error: Unable to send file A Test Story [1].epub. HTML Headers have already been sent from /homepages/5/d609431004/htdocs/whimsicalwanderings/writing/modules/epubversion/epubversion.php in line 162

Any ideas?


 
Posted : 03/03/2016 2:11 pm
(@piper)
Posts: 91
Trusted Member
Topic starter
 

Can you tell me what version of PHP you are using?

-Piper


StoryPortal Fiction Network - StoryPortal.Net
TG Fiction dot NET | T* Fiction Archive - TGFiction.Net
LG Tales | TG Style Fiction for LG's - LGTales.Com

 
Posted : 26/04/2016 9:06 pm
(@piper)
Posts: 91
Trusted Member
Topic starter
 

I just did a fresh install of Efiction, followed by an install of this module. Everything went fine until I tried downloading an EPUB. It gave me a bunch of errors, most of which had to do with the time/date. I edited all of those instances out of the PHP files, which solved that issue, but I'm still having trouble with these:

Notice: Array to string conversion in /homepages/5/d609431004/htdocs/whimsicalwanderings/writing/modules/epubversion/epubversion.php on line 162

Notice: Undefined variable: img_filename in /homepages/5/d609431004/htdocs/whimsicalwanderings/writing/modules/epubversion/cover_img.php on line 90

Error: Unable to send file A Test Story [1].epub. HTML Headers have already been sent from /homepages/5/d609431004/htdocs/whimsicalwanderings/writing/modules/epubversion/epubversion.php in line 162

Any ideas?

Honestly, the 2 notices are just that, notices and that kind of error reporting should be turned off in a production site. The one fatal error stems from the fact that you have the error reporting turned on and so it's creating a page-header before the page header the script sends. Which causes a fatal error. If you turn off error reporting you should be fine, but I will try and work to improve my coding practices.

-Piper


StoryPortal Fiction Network - StoryPortal.Net
TG Fiction dot NET | T* Fiction Archive - TGFiction.Net
LG Tales | TG Style Fiction for LG's - LGTales.Com

 
Posted : 03/05/2016 2:59 pm
(@snowhitesally)
Posts: 30
Eminent Member
 

When I try and install this module, I get this error, any ideas?

A fatal MySQL error was encountered.
Query: select `epubimg` from `settingsfanfiction_settings` limit 0
Error: ()


 
Posted : 28/08/2016 1:58 pm
(@ladama)
Posts: 57
Trusted Member
 

I am also trying to install this. I was having the same problem as Sally, but then I replaced the install.php code with the code that SJP posted upthread and appeared to be able to install the module.

However I'm now getting the same error Heatherlly posted about above, trying to download an epub and getting these error messages:

Notice: Array to string conversion in /home/ladama/jimothy/fanfiction/modules/epubversion/epubversion.php on line 164

Notice: Undefined variable: img_filename in /home/ladama/jimothy/fanfiction/modules/epubversion/cover_img.php on line 90

Error: Unable to send file Anywhere But Here [1].epub. HTML Headers have already been sent from /home/ladama/jimothy/fanfiction/modules/epubversion/epubversion.php in line 164

Piper said to turn off error reporting but as far as I know it's turned off, I have the "Display Debug Info" setting switched off in the "Site Settings"  of eFiction, is there also some code I should be adding or removing somewhere like in the header.php?


 
Posted : 29/08/2016 3:37 am
(@ladama)
Posts: 57
Trusted Member
 

So after some poking around I got this module mostly working (finally!) but there are still several annoying things going on so any assistance with this is appreciated!

Firstly, it looks like the storyportal site is down right now, but the module is available here: https://github.com/geekbrat/ePubVersion

How I got it to work!
* First, I replace the install.php code with what SJP posted upthread.
* Next I went into the epubversion.php file and on line 9 changed the error reporting value from E_ALL to 0 (zero)
At this point I can install the module no problem and, once the {printepub} tag is on the proper TPL files, I could download a file, except the ePub file downloaded just had errors.
So now I -
* go to admin>module>epub version options and for "HTML Filters?" I select "PURE"
(EDIT: I figured out how to turn on TIDY, most hosts/servers have it installed but the user has to initiate it. You can do this in your CPanel, or if you have DreamHost like we do you can do it this other somewhat convoluted way, let me know if you have DH and need help! I don't know if there's a noticeable difference but TIDY is apparently faster. Either way, you need the HTML filters set to something and not just "none" to get this to work!)

Now I can actually download a functional ePub file!
Here's my tester site: http://jimothy.just-once.net/fanfiction/ <---I sometimes keep it in maintenance mode just in case one of our users stumble onto it, you can log in with username and password "admintest"

So that's the good news, now onto some of the issues!

*Personally, I want only registered/logged in users to be able to download ePub files, but when I disable anon downloads in the module settings, then attempt to download, it just sends me to a page that reads: "We are sorry, but we have chosen to disable ePub eBook creation for non logged-in users." Trouble is I AM logged in! Any clue where to start looking to fix this?

*On the Table of Contents page (the storyindex.tpl) of a multi-chapter story, when I click the ePub download it will only render the first chapter. When I'm viewing the story (viewstory.tpl) it will give me both "chapter" or "story" download options. How to I get it to render the whole story if a user clicks the download link in the table of contents?

I'm also having all the same problems detailed upthread in this reply:
* There's no break or other delineation between the chapter notes and the chapter text
* Some stories won't work in eReaders especially if there is certain punctuation or accented letters in the story title or chapter title.
* The user that's uid=1 is put as a co-author on many of the stories.

I think that's it, mostly minor but still annoying. The disabling anon downloads is what I most want to fix (I'm hoping to use this feature as incentive for people to sign up and log in!) but help with anything is appreciated!


 
Posted : 22/09/2016 4:44 pm
(@ladama)
Posts: 57
Trusted Member
 

*Personally, I want only registered/logged in users to be able to download ePub files, but when I disable anon downloads in the module settings, then attempt to download, it just sends me to a page that reads: "We are sorry, but we have chosen to disable ePub eBook creation for non logged-in users." Trouble is I AM logged in! Any clue where to start looking to fix this?

*On the Table of Contents page (the storyindex.tpl) of a multi-chapter story, when I click the ePub download it will only render the first chapter. When I'm viewing the story (viewstory.tpl) it will give me both "chapter" or "story" download options. How to I get it to render the whole story if a user clicks the download link in the table of contents?

Did a little more tinkering and at least figured out the download chapter problem. In the ePub module folder, I went to the storyblock.php and on line 47 where it says:

else $printepub = "<a href=""modules/epubversion/epubversion.php?sid=$sid&amp;chapter=1">[/code"]

I changed it to "chapter=all" . I also did the same change in "storyblock2.php" for good measure.

Now with the disabling anon download, I found this around line 141
if(!isMEMBER && !$settings['epubanon']) {
die(_EPUBERRORANON);
}

and changed it to

if(!isMEMBER && !$settings['epubanon'] == "0") {
die(_EPUBERRORANON);
}

Adding the '== "0"' at least seems to solve the problem before where I wasn't able download the ePub even if I was logged in, now anon users don't see any ePub download links while logged-in users do.

However I actually want non-logged in users to see the ePub download links and then click and get the "registered users only" message, and/or have the number of ePub downloads be on display to everyone (with the disable anon downloads selected) as right now that download total disappears if anon downloads are disabled. This isn't essential, but still something I'd like!


 
Posted : 22/09/2016 7:14 pm
(@snowhitesally)
Posts: 30
Eminent Member
 

Is there a way to add the epub downloads to the top ten section? I'd love for people to see who is most downloaded etc?


 
Posted : 17/10/2016 12:08 pm
(@guest17300)
Posts: 0
 

so today i installed this mod to our website. it's all fine, even though we had to hack our way in the database to change NONE setting to PURE, but it works nonetheless. now, two problems:

> some stories (not all of them) return a corrupt epub file.
> turkish characters don't exist at all. i tried the basic things from changing character settings to iso-8xxx-9 for turkish, to change the language from story settings etc. any suggestions?


 
Posted : 04/03/2017 8:01 pm
Page 8 / 9
Share: