From 7636271c6175e01c913af9e97dd51e53bd5ad4d4 Mon Sep 17 00:00:00 2001 From: Banana Date: Fri, 27 Dec 2019 13:51:03 +0100 Subject: [PATCH] cleaning up for 2.2 release --- ChangeLog | 173 +++++++++++++++--------------- TODO | 5 +- VERSION | 2 +- documentation/email-importer.txt | 3 +- documentation/installation.txt | 3 + documentation/usage.txt | 1 + webroot/config.default.php | 1 + webroot/index.php | 2 +- webroot/job/email-import.php | 17 ++- webroot/lib/simple-imap.class.php | 42 +++----- 10 files changed, 121 insertions(+), 128 deletions(-) diff --git a/ChangeLog b/ChangeLog index c32950f..52a9ee7 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,180 +1,183 @@ -version 2.2 - Guardian of Ice - (tba) - - * email import - * using mysql transactions if needed - * pagination - * authentication with an extra url now (index.php?m=auth) - * management actions shown only if authenticated - * small stats overview - * links can now be deleted - * awaiting moderation links can new be moderated - * clean up the local storage via stats page (if authenticated) - * Updated documentation - * INFO, WARN and ERROR now in the log files used for messages - * Fixed an error in create sql file - * Fixed info when a tag or category has no links - * Fixed code cleanups - * Fixed access to log files directory - * Fixed check for duplicates in email importer +version 2.2 - Guardian of Ice - (2019-02-27) + + + email import + + using mysql transactions if needed + + pagination + + authentication with an extra url now (index.php?m=auth) + + management actions shown only if authenticated + + small stats overview + + links can now be deleted + + awaiting moderation links can new be moderated + + clean up the local storage via stats page (if authenticated) + + Updated documentation + + INFO, WARN and ERROR now in the log files used for messages + + stats, storage usage. With stats and valid auth display moderation + + email import auto reply check + + flush local storage of images + + Fixed an error in create sql file + + Fixed info when a tag or category has no links + + Fixed code cleanups + + Fixed access to log files directory + + Fixed check for duplicates in email importer version 2.1alpha - Guardian of Fire - (2019-09-29) - * cleanups - * edit area for a bookmark - * documentation and sql setup cleanup - * new design with bulma.css (https://bulma.io/) - * added SEO information to "prevent" crawling and a robots.txt file - * new option to restrict access via http basic auth. - * very simple user authentication based on http basic auth. + + cleanups + + edit area for a bookmark + + documentation and sql setup cleanup + + new design with bulma.css (https://bulma.io/) + + added SEO information to "prevent" crawling and a robots.txt file + + new option to restrict access via http basic auth. + + very simple user authentication based on http basic auth. Needs improvement in further releases - * using mysql transactions - * working with new MySQL (5.7) version - * Image from parsed link info can now be stored + + using mysql transactions + + working with new MySQL (5.7) version + + Image from parsed link info can now be stored version 2.0alpha - Bright Crucible - (2017-01-05) - * This is a not prodction ready version of the complete rewrite. - * It is now written in PHP based on the idea from Luke Reeves + + This is a not prodction ready version of the complete rewrite. + + It is now written in PHP based on the idea from Luke Reeves version 1.5 (30 Nov. 2012) - * support phantomjs as a screenshot tool for a bookmark - * code updates and cleanup + + support phantomjs as a screenshot tool for a bookmark + + code updates and cleanup version 1.1 (20 Feb. 2012) - * older and newer link at the top no working - * bug with path to the jquery.js file - * some statistics - * options can be ordered now - * tool to check the bookmarks + + older and newer link at the top no working + + bug with path to the jquery.js file + + some statistics + + options can be ordered now + + tool to check the bookmarks version 1.0 (15. Feb 2012) - * jumpin.banana - * tag suggest was not working correctly. - * tag rename feature implemented - * tag rename case sensitive problem - * add bookmark only if url and title are not empty - * tag delete is available now. It moves the selected bookmarks + + jumpin.banana + + tag suggest was not working correctly. + + tag rename feature implemented + + tag rename case sensitive problem + + add bookmark only if url and title are not empty + + tag delete is available now. It moves the selected bookmarks to another one - * bookmarks without a tag can be selected now - * Fix the text/html content type going that's snapshotted + + bookmarks without a tag can be selected now + + Fix the text/html content type going that's snapshotted This is not needed. Since we use the charset info to determine utf, we need this information - * Insert SQL more save now + + Insert SQL more save now Tue Jul 14 21:38 EST 2009 Luke Reeve - * Fix the option "proxy_host" not being saved correctly. + + Fix the option "proxy_host" not being saved correctly. Sun Jul 12 11:00 EST 2009 Luke Reeves - * Fixed the Perl 5.10 module reloading bug. - * Fixed snapshotting functionality + + Fixed the Perl 5.10 module reloading bug. + + Fixed snapshotting functionality Sat Jul 11 23:30 EST 2009 Luke Reeves - * Dusted off the codebase, kicked the tires and finally + + Dusted off the codebase, kicked the tires and finally finished off the git migration. Mon Mar 27 18:59 EST 2006 Luke Reeves - * Added an option for disabling mod_rewrite support - * Added a prefix option for database tables + + Added an option for disabling mod_rewrite support + + Added a prefix option for database tables Tue Mar 21 19:34 EST 2006 Luke Reeves - * Fix the export system + + Fix the export system Tue Feb 21 12:30 EST 2006 Luke Reeves - * Fix up database connectivity for newer PostgreSQL + + Fix up database connectivity for newer PostgreSQL libraries - * Incorporate patch from Paul Boin that allows importing + + Incorporate patch from Paul Boin that allows importing of regular del.icio.us backups (as opposed to only supporting exports as before) Mon Nov 21 12:41 EST 2005 Luke Reeves - * Fixed some of the cleanup process for snapshot deletion - * Added a "Fetch Related" function, so that the snapshot + + Fixed some of the cleanup process for snapshot deletion + + Added a "Fetch Related" function, so that the snapshot tool can grab related objects - * Work on the tag tools - delete and rename tags + + Work on the tag tools - delete and rename tags Fri Nov 04 09:00 EST 2005 Luke Reeves - * Database fix (thanks to Jutta Horstmann) - * Remove export and import to server-side files, since the + + Database fix (thanks to Jutta Horstmann) + + Remove export and import to server-side files, since the standalone tools can easily accomplish that Fri Sep 23 07:35 EST 2005 Luke Reeves - * Enable taint mode for all the modules/scripts. + + Enable taint mode for all the modules/scripts. Thu Sep 22 12:15 EST 2005 Luke Reeves - * Remove dependency on App::Config, since all it does is + + Remove dependency on App::Config, since all it does is read a simple text file. - * Remove dependency on CGI::Session in lieu of a built-in + + Remove dependency on CGI::Session in lieu of a built-in session management system - * Fixed up database tables + + Fixed up database tables Mon Sep 19 20:37 EST 2005 Luke Reeves - * Add the ability to drill-down into more details on cached + + Add the ability to drill-down into more details on cached objects. - * Fix up the standalone import and export tools. - * Show the correct total size of snapshots in the snapshot + + Fix up the standalone import and export tools. + + Show the correct total size of snapshots in the snapshot view. Fri Sep 16 21:02 EST 2005 Luke Reeves - * Move tools to a separate directory - * Add a standalone export script. - * Fix bugs in the export concerning character encoding. + + Move tools to a separate directory + + Add a standalone export script. + + Fix bugs in the export concerning character encoding. Fri Sep 16 12:30 EST 2005 Luke Reeves - * Fix a couple possible installation issues on PostgreSQL + + Fix a couple possible installation issues on PostgreSQL systems. Mon Sep 05 22:28 EST 2005 Luke Reeves - * Major code cleanup (splitting the main CGI file into multiple, + + Major code cleanup (splitting the main CGI file into multiple, more maintainable ones inside of the lib/Insipid directory) - * Bugfix for adding duplicate items not being flagged as such + + Bugfix for adding duplicate items not being flagged as such Tue Aug 09 22:05 EST 2005 Luke Reeves - * Added proxy support for fetching pages - * Fix blob size for MySQL tables - * Added a toggle to not redirect when a mark is added - * Added a toggle to snapshot a page when bookmarked - * Support passing the Referer header when snapshotting a page. - * Added support for If-Modified-Since requests to cached objects. - * Added a Last-Modified header for cache objects. + + Added proxy support for fetching pages + + Fix blob size for MySQL tables + + Added a toggle to not redirect when a mark is added + + Added a toggle to snapshot a page when bookmarked + + Support passing the Referer header when snapshotting a page. + + Added support for If-Modified-Since requests to cached objects. + + Added a Last-Modified header for cache objects. Thu Jul 21 21:35 EST 2005 Luke Reeves - * Fix a bunch of errors concerning PostgreSQL and the snapshots, + + Fix a bunch of errors concerning PostgreSQL and the snapshots, as well as other bug fixes. Sun Jul 17 15:19 EST 2005 Luke Reeves - * Added the page cache feature, so a user can take snapshots of pages + + Added the page cache feature, so a user can take snapshots of pages that have been bookmarked. Tue Jul 05 21:58 EST 2005 Luke Reeves - * Added addition of tags (like Documentation + Java) to get + + Added addition of tags (like Documentation + Java) to get intersections of bookmarks. Fri May 27 11:05 JST 2005 Luke Reeves - * Added postgresql backend support (submitted by Stephen Patterson) + + Added postgresql backend support (submitted by Stephen Patterson) Mon Apr 25 21:00 EST 2005 Luke Reeves - * Add a search box, with the option of showing it to non-logged in + + Add a search box, with the option of showing it to non-logged in users. diff --git a/TODO b/TODO index e0d988b..92808ad 100755 --- a/TODO +++ b/TODO @@ -1,8 +1,5 @@ TODO / Feature list -========================================================================== -+ stats, storage usage. With stats and valid auth display moderation -+ email import auto reply check -+ flush local storage of images ++ improved documentation + delete single local storage of a link + sorting + snapshots diff --git a/VERSION b/VERSION index 8d9021d..d95cf21 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2alpha - Guardian of Ice +2.2 - Guardian of Ice diff --git a/documentation/email-importer.txt b/documentation/email-importer.txt index e22c332..c13f0af 100644 --- a/documentation/email-importer.txt +++ b/documentation/email-importer.txt @@ -15,10 +15,11 @@ Here are the important configs: EMAIL_SERVER => Address of your E-Mail server EMAIL_SERVER_PORT_IMAP => The SSL Imap port. Default: 993 EMAIL_SERVER_MAILBOX => The name of your Inbox. Default: INBOX +EMAIL_ARCHIVE_FOLDER => The name of the archive folder in which the processed emails will be moved EMAIL_REPORT_BACK => set this to true if you want to report to the sender. Default: false EMAIL_SERVER_PORT_SMTP => The SSL SMTP port for using the report back function. Default: 465 -EMAIL_REPLY_BACK_VALID => Multiple E-Mails addresses which can be reported back to. +EMAIL_REPLY_BACK_VALID => Multiple E-Mails addresses which can be reported back to. RFC822-style comma-separated email addresses EMAIL_REPLY_BACK_ADDRESS => The E-Mail address which sends the report mail. Usually the address from which your read the mails diff --git a/documentation/installation.txt b/documentation/installation.txt index 0ab884b..28cb3cb 100644 --- a/documentation/installation.txt +++ b/documentation/installation.txt @@ -42,3 +42,6 @@ LOCAL_STORAGE is the option in the config file. 9. If you want to fully restrict your contents activate the user/password restriction in the config. + +10. +If you want to use the e-mail importer read the email-importer.txt file. diff --git a/documentation/usage.txt b/documentation/usage.txt index 1939ee5..52e2d76 100644 --- a/documentation/usage.txt +++ b/documentation/usage.txt @@ -9,6 +9,7 @@ Call the following URL to trigger the authentication: http(s)://your.domain.tld/path/to/insipid/index.php?m=auth If successful you can now manage your items. Edit buttons are visible now. +Moderation and more overview can be access from the stats overview page. HowToAdd a new link: diff --git a/webroot/config.default.php b/webroot/config.default.php index aae4a19..6092892 100644 --- a/webroot/config.default.php +++ b/webroot/config.default.php @@ -59,6 +59,7 @@ define('EMAIL_SERVER_PORT_IMAP',993); define('EMAIL_SERVER_PORT_SMTP',465); define('EMAIL_SERVER_MAILBOX','INBOX'); # default INBOX define('EMAIL_MARKER','to-insipid- '); +define('EMAIL_ARCHIVE_FOLDER','archive'); define('EMAIL_REPORT_BACK',false); define('EMAIL_REPLY_BACK_VALID',''); define('EMAIL_REPLY_BACK_ADDRESS',''); diff --git a/webroot/index.php b/webroot/index.php index 4150334..7a3013c 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -32,7 +32,7 @@ ini_set('error_reporting',-1); // E_ALL & E_STRICT # time settings date_default_timezone_set('Europe/Berlin'); -define('DEBUG',true); +define('DEBUG',false); ## check request $_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); diff --git a/webroot/job/email-import.php b/webroot/job/email-import.php index b090ce6..8c68988 100644 --- a/webroot/job/email-import.php +++ b/webroot/job/email-import.php @@ -3,7 +3,7 @@ * Insipid * Personal web-bookmark-system * - * Copyright 2016-2017 Johannes Keßler + * Copyright 2016-2019 Johannes Keßler * * Development starting from 2011: Johannes Keßler * https://www.bananas-playground.net/projekt/insipid/ @@ -32,7 +32,7 @@ ini_set('error_reporting',-1); // E_ALL & E_STRICT # time settings date_default_timezone_set('Europe/Berlin'); -define('DEBUG',true); +define('DEBUG',false); ## set the error reporting ini_set('log_errors',true); @@ -170,7 +170,7 @@ if(!empty($emails)) { } } else { - error_log("WARN No valid title for link found: ".var_export($newdata,true)); + error_log("WARN No valid title for link found: ".$newdata['link']); if(DEBUG === true) var_dump("WARN No valid title for link found: ".var_export($newdata,true)); array_push($invalidProcessedEmails, $emailData); continue; @@ -208,7 +208,7 @@ if(!empty($emails)) { 'image' => $newdata['image'] ), true); } catch (Exception $e) { - $_m = "WARN Can not create new link into DB. Duplicate? " . $e->getMessage(); + $_m = "WARN Can not create new link into DB." . $e->getMessage(); error_log($_m); $emailData['importmessage'] = $_m; array_push($invalidProcessedEmails, $emailData); @@ -246,7 +246,7 @@ if(!empty($emails)) { } else { $DB->rollback(); - error_log("ERROR Link could not be added. SQL problem: ".$newdata['link']); + error_log("ERROR Link could not be added. SQL problem? ".$newdata['link']); $emailData['importmessage'] = "Link could not be added"; array_push($invalidProcessedEmails,$emailData); } @@ -277,14 +277,13 @@ if(!empty($invalidProcessedEmails)) { } # move them to the processed / archive folder -#$EmailReader->move() if(!empty($validProcessedEmails)) { error_log("INFO We have valid import messages."); foreach ($validProcessedEmails as $validMail) { + $EmailReader->moveMessage($validMail['uid']); + error_log("INFO Mail moved to archive ".$validMail['header_rfc822']->subject); } } - - $DB->close(); -# END +$EmailReader->close(); diff --git a/webroot/lib/simple-imap.class.php b/webroot/lib/simple-imap.class.php index 47bb627..a6ee6f2 100644 --- a/webroot/lib/simple-imap.class.php +++ b/webroot/lib/simple-imap.class.php @@ -103,7 +103,8 @@ class SimpleImap { $ret[$i]['header'] = $this->emailHeaders($i); $ret[$i]['header_rfc822'] = $this->emailHeaders_rfc822($i); $ret[$i]['header_array'] = $this->emailHeadersAsArray($i); - $ret[$i]['emailid'] = $i; + # @see https://www.php.net/manual/en/function.imap-uid.php + $ret[$i]['uid'] = imap_uid($this->_connection,$i); } } } @@ -176,6 +177,19 @@ class SimpleImap { return array_combine( $matches[1], $matches[2]); } + /** + * Move given message to given folder + * @param $messageUid This is the message Uid as an int + * @param string $folder This is the target folder. Default is EMAIL_ARCHIVE_FOLDER + */ + public function moveMessage($messageUid,$folder=EMAIL_ARCHIVE_FOLDER) { + if(!empty($messageUid) && !empty($folder)) { + $messageUid = (string)$messageUid; + imap_setflag_full($this->_connection,$messageUid,"\SEEN", ST_UID); + imap_mail_move($this->_connection, $messageUid, $folder,CP_UID); + imap_expunge($this->_connection); + } + } /** * extract the subject from the email headers and decode @@ -247,32 +261,6 @@ class SimpleImap { return $ret; } - /* - - // move the message to a new folder - function move($msg_index, $folder='INBOX.Processed') { - // move on server - imap_mail_move($this->_connection, $msg_index, $folder); - imap_expunge($this->_connection); - - // re-read the inbox - $this->inbox(); - } - - // get a specific message (1 = first email, 2 = second email, etc.) - function get($msg_index=NULL) { - if (count($this->_inbox) <= 0) { - return array(); - } - elseif ( ! is_null($msg_index) && isset($this->_inbox[$msg_index])) { - return $this->_inbox[$msg_index]; - } - - return $this->_inbox[0]; - } -*/ - - /** * close the imap connection */ -- 2.39.5