Skip to content

Commit

Permalink
disabled line wrapping when switching to text editor mode; updates #236
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Sep 17, 2015
1 parent 73d0e93 commit 51f0c1b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions htdocs/lib/consts.inc.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
define('GUI_HTML', 0); // also defined in lib2/const.inc.php define('GUI_HTML', 0); // also defined in lib2/const.inc.php
define('GUI_TEXT', 1); define('GUI_TEXT', 1);


define('EMAIL_LINEWRAP', 72);

// for cachelists // for cachelists
define('cachelist_type_ignore', 1); define('cachelist_type_ignore', 1);
define('cachelist_type_watch', 2); define('cachelist_type_watch', 2);
Expand Down
2 changes: 2 additions & 0 deletions htdocs/lib2/const.inc.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@
define('DB_MODE_BUSINESSLAYER', 1); define('DB_MODE_BUSINESSLAYER', 1);
define('DB_MODE_USER', 2); define('DB_MODE_USER', 2);
define('DB_DATE_FORMAT', '%Y-%m-%d %H:%M:%S'); define('DB_DATE_FORMAT', '%Y-%m-%d %H:%M:%S');

define('EMAIL_LINEWRAP', 72);
?> ?>
7 changes: 5 additions & 2 deletions htdocs/lib2/edithelper.inc.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function processEditorInput($oldDescMode, $descMode, $text)
} }


// ... and HTML to plain text // ... and HTML to plain text
$text = html2plaintext($text, $oldDescMode = 0); $text = html2plaintext($text, $oldDescMode = 0, 0);


$text = str_replace(array('[s![',']!s]'), '', $text); $text = str_replace(array('[s![',']!s]'), '', $text);
} }
Expand All @@ -81,8 +81,10 @@ function processEditorInput($oldDescMode, $descMode, $text)


// $texthtml0 is set if the text is from cache_desc.desc or cache_logs.text // $texthtml0 is set if the text is from cache_desc.desc or cache_logs.text
// and text_html is 0, i.e. the text was edited in the "text" editor mode. // and text_html is 0, i.e. the text was edited in the "text" editor mode.
//
// If $wrap is > 0, longer lines will be wrapped to new lines.


function html2plaintext($text, $texthtml0) function html2plaintext($text, $texthtml0, $wrap)
{ {
global $opt, $absolute_server_URI; global $opt, $absolute_server_URI;


Expand All @@ -95,6 +97,7 @@ function html2plaintext($text, $texthtml0)
else else
{ {
$h2t = new html2text($text); $h2t = new html2text($text);
$h2t->width = $wrap;
$h2t->set_base_url(isset($opt['page']['absolute_url']) ? $opt['page']['absolute_url'] : $absolute_server_URI); $h2t->set_base_url(isset($opt['page']['absolute_url']) ? $opt['page']['absolute_url'] : $absolute_server_URI);
$text = $h2t->get_text(); $text = $h2t->get_text();


Expand Down
2 changes: 1 addition & 1 deletion htdocs/lib2/html2text.class.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class html2text
* @var integer $width * @var integer $width
* @access public * @access public
*/ */
var $width = 70; var $width = 72;


/** /**
* List of preg* regular expression patterns to search for, * List of preg* regular expression patterns to search for,
Expand Down
2 changes: 1 addition & 1 deletion htdocs/removelog.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
$message = $removed_message_title . "\n" . $message . "\n" . $removed_message_end; $message = $removed_message_title . "\n" . $message . "\n" . $removed_message_end;
} }


$logtext = html2plaintext($log_record['log_text'], $log_record['text_html'] == 0); $logtext = html2plaintext($log_record['log_text'], $log_record['text_html'] == 0, EMAIL_LINEWRAP);


//get cache owner name //get cache owner name
$cache_owner_rs = sql("SELECT `username` FROM `user` WHERE `user_id`='&1'", $log_record['cache_owner_id']); $cache_owner_rs = sql("SELECT `username` FROM `user` WHERE `user_id`='&1'", $log_record['cache_owner_id']);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/util/watchlist/runwatch.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function process_owner_log($user_id, $log_id)
$rLog = sql_fetch_array($rsLog); $rLog = sql_fetch_array($rsLog);
mysql_free_result($rsLog); mysql_free_result($rsLog);


$logtext = html2plaintext($rLog['text'], $rLog['text_html'] == 0); $logtext = html2plaintext($rLog['text'], $rLog['text_html'] == 0, EMAIL_LINEWRAP);


$language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); $language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null);
if (!$language) if (!$language)
Expand Down Expand Up @@ -263,7 +263,7 @@ function process_log_watch($user_id, $log_id)
$rLog = sql_fetch_array($rsLog); $rLog = sql_fetch_array($rsLog);
mysql_free_result($rsLog); mysql_free_result($rsLog);


$logtext = html2plaintext($rLog['text'], $rLog['text_html'] == 0); $logtext = html2plaintext($rLog['text'], $rLog['text_html'] == 0, EMAIL_LINEWRAP);


$language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); $language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null);
if (!$language) if (!$language)
Expand Down

0 comments on commit 51f0c1b

Please sign in to comment.