Submit Button

This is the right place to report general bugs, make suggestions or ask for help.
User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Thu Jul 03, 2025 8:31 pm

Going back to this issue, I added the changes to the admin.entry.write.php file and am getting the following error message:

Code: Select all

[Thu Jul 03 13:24:35.423232 2025] [php7:error] [pid 14256:tid 1288] [client 127.0.0.1:56480] PHP Parse error:  syntax error, unexpected 'protected' (T_PROTECTED) in C:\\usbwebserver8.6.3\\root\\fathers_life\\admin\\panels\\entry\\admin.entry.write.php on line 210
Line 210 contains this:

Code: Select all

protected function outputEntryUrl($id) {
			$url = get_permalink($id);
			//if ($url) {
				//echo '<div class="entry-url">';
				//echo 'URL of the entry: <a href="' . esc_url($url) . '">' . esc_html($url) . '</a>';
				//echo '</div>';
			//}
		}
I'm also still trying to determine where I would add the include statement after these changes.

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Fri Jul 04, 2025 6:17 pm

Hello WineMan,

I have adjusted the admin.entry.write file a little. Now the parse error should no longer occur.
admin.entry.write2.zip
(1.96 KiB) Downloaded 637 times
In line 186 I have marked a possible position where you can include your file.

Line 187 displays the entry url.

Have a good weekend
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Fri Jul 04, 2025 7:34 pm

Thank you fraenkiman...I will make the changes and hope that it will work. I appreciate all your help.

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Fri Jul 04, 2025 8:52 pm

Well, the parse error message is gone, so that is a good thing. Unfortunately, the email notification is not sent and the text file containing the titles of the article is not being updated. Here is the code I am using based on your suggestion.
// Additional output of the entry URL
if (!$do_preview && is_numeric($success) && $success > 0) {
include '/home/domain/public_html/myflatpress/notify/index1.php';
// Include your file here
$this->outputEntryUrl($success);
}
Do you see any issue with this as written?

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Sat Jul 05, 2025 11:10 pm

Hello WineMan,

I have taken a closer look at the code of the index1.php file.
Regardless of whether the inclusion of index1.php succeeds, it will fail to generate the content from the feed for the email. index1.php expects the new entry. Although this already exists when the new entry is saved, the feed XML has already been parsed - but does not contain the newly saved entry. At this point, the savecont.txt file only contains the list of previous entries, without the new entry that you have saved.

The code in the index1.txt file also contains another weakness: it sends an e-mail to all subscribers in the data.txt file at the same time. Assuming you have 50 subscribers, your mail provider only allows 10 emails to be sent per hour to prevent you from generating mass spam, 40 will fall by the wayside.

What do you think of the idea of modifying the latest version of the newsletter plugin so that it creates the content of the mail from the RSS feed instead of from the LastEntries and LastComments plugins? This has several advantages:

The widget already exists.
By switching from “Write new entry” to “Newsletter”, the feed XML is read again and compared with savecont.txt.

Your subscriber also has the advantage of being able to unsubscribe if they no longer wish to receive emails. The code in index1.php does not take this into account. Sooner or later, you could incur the wrath of those who no longer wish to receive emails from you.

Another weakness is that I could enter someone else's email in your blog parser widget. Hundreds of them, even though these email addresses don't belong to me. This makes you an unintentional spammer because your widget does not validate (opt-in) the email address you enter.

The newsletter plugin already provides a double opt-in.

Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Sun Jul 06, 2025 12:17 am

Another vulnerability is that all email addresses are stored as plain text in the data.txt file. The bad guy could easily intercept the email addresses by calling BLOG_BASEURL . notify/data.txt in the browser. In this way, you inadvertently become a distributor of personal data. This is a major problem in the European Union.

The newsletter plugin encrypts the e-mail addresses of subscribers.

https://frank-web.dedyn.io/fp-content/p ... ribers.txt
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Sun Jul 06, 2025 1:57 am

In addition, another unpleasant situation arises. Assuming you need to correct the content of your entry and click on Save (onsubmit()), the subscriber will receive an email every time, even though you only wanted to correct a typo. Although the code from https://www.formget.com/ works, it has many pitfalls that could make your life difficult.
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Sun Jul 06, 2025 4:40 pm

Those are all good suggestions fraenkiman...and perhaps you're right, modifying the newspaper plugin may be the way to go.

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Mon Jul 07, 2025 3:15 pm

fraenkiman wrote: Sat Jul 05, 2025 11:10 pm
What do you think of the idea of modifying the latest version of the newsletter plugin so that it creates the content of the mail from the RSS feed instead of from the LastEntries and LastComments plugins? This has several advantages:

The widget already exists.
By switching from “Write new entry” to “Newsletter”, the feed XML is read again and compared with savecont.txt.
The savecont.txt is not updated until the index1.php file is generated so it could not be compared. The txt file would have to be updated as soon as an article is posted in order for this to work.

I'm confused by what you mean in your comment of "Switching from Write new entry" to "Newsletter"...

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Tue Jul 08, 2025 8:50 pm

WineMan wrote: Mon Jul 07, 2025 3:15 pm I'm confused by what you mean in your comment of "Switching from Write new entry" to "Newsletter"...
...new HTTP request

Let me try to simplify the process - without any guarantee of completeness:

The RSS feed is only enriched with your new entry when someone accesses the feed URL after saving and FlatPress runs the feed script. When you click on “Publish”, the following happens internally:

1. saving the entry
  • The admin module writes your raw BBCode to a TXT file under /content/$year/$month/entryYYMMDD-HHMMSS.txt.
  • At this point, the file exists, but no feed has been generated yet.
2. feed call
  • Only in the next HTTP request to ?x=feed:rss2 does FlatPress switch to feed mode.
  • Now all TXT files in the content folder are read in - including the one just created.
3. BBCode parsing & filter
  • For each loaded entry, FlatPress executes bbcode_parse($entry[‘content’]) and then applies the filter hooks (flatpress_filter_content()).
  • Only then will the HTML content be available in the <description> field of the feed.
4. template rendering
  • Smarty loads the feed template (rss2.tpl), receives the entries that have already been converted to HTML and outputs the complete RSS XML.
You will therefore not be able to save the new entry in the feed.
You then have to change the menu in the admin area to trigger a new HTTP request. Only then could you trigger the comparison "old" vs. "new" with your feedmailer file (index1.php) and send the new entry as a mail.

Hence my idea of triggering the comparison and sending from a separate plugin, because this triggers a different menu in the admin area (new HTTP request to ?x=feed:rss2) and the new entry is then available for sending.
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests