Commit 78194340 authored by stimpy's avatar stimpy

fixed several htmlentities bugs

parent 02cb91e2
......@@ -58,6 +58,8 @@
if ( $amb->isAllowedGroup( $user['username'], $echo ) ) {
$lastnum = $jam->getLastNumActive( $echos[$echo]['filename'] );
$message = $jam->getMessage( $echos[$echo]['filename'], $lastnum-$msgid );
$message['text'] = str_replace( '<', '&lt;', $message['text'] );
$message['text'] = str_replace( '>', '&gt;', $message['text'] );
$message['text'] = $amb->colorize( $amb->linkify( $message['text'] ) );
echo json_encode( $message );
}
......
......@@ -40,8 +40,8 @@
return $input;
}
function linkify( $input ) {
$input = preg_replace( '/(https?:\/\/[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6}[^\s@>]*)\s/', '<a href="$1" target="_blank">$0</a>', urldecode( $input ) );
$input = preg_replace( '/([a-zA-Z0-9_\.-]+@[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6})/', '<a href="mailto:$1">$0</a>', urldecode( $input ) );
$input = preg_replace( '/(https?:\/\/[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6}[^\s@>]*)\s/', '<a href="$1" target="_blank">$0</a>', $input );
$input = preg_replace( '/([a-zA-Z0-9_\.-]+@[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6})/', '<a href="mailto:$1">$0</a>', $input );
return $input;
}
}
......@@ -280,6 +280,7 @@
if ( flock( $fp, LOCK_SH ) ) {
fseek( $fp, $ret['header']['offset'] );
$ret['text'] = fread( $fp, $ret['header']['txtlen'] );
if ( $chrs != 'UTF-8' ) {
if ( ( $iconv = @iconv( $chrs, 'UTF-8', $ret['text'] ) ) !== false ) {
$ret['text'] = $iconv;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,9 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/W:/website_jamreader/src/assets/classes/jam.class.php</file>
<file>file:/W:/website_jamreader/src/assets/classes/helper.class.php</file>
</group>
<group/>
</open-files>
</project-private>
......@@ -58,6 +58,8 @@
if ( $amb->isAllowedGroup( $user['username'], $echo ) ) {
$lastnum = $jam->getLastNumActive( $echos[$echo]['filename'] );
$message = $jam->getMessage( $echos[$echo]['filename'], $lastnum-$msgid );
$message['text'] = str_replace( '<', '&lt;', $message['text'] );
$message['text'] = str_replace( '>', '&gt;', $message['text'] );
$message['text'] = $amb->colorize( $amb->linkify( $message['text'] ) );
echo json_encode( $message );
}
......
......@@ -40,8 +40,8 @@
return $input;
}
function linkify( $input ) {
$input = preg_replace( '/(https?:\/\/[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6}[^\s@>]*)\s/', '<a href="$1" target="_blank">$0</a>', urldecode( $input ) );
$input = preg_replace( '/([a-zA-Z0-9_\.-]+@[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6})/', '<a href="mailto:$1">$0</a>', urldecode( $input ) );
$input = preg_replace( '/(https?:\/\/[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6}[^\s@>]*)\s/', '<a href="$1" target="_blank">$0</a>', $input );
$input = preg_replace( '/([a-zA-Z0-9_\.-]+@[\da-zA-Z\.-]+\.[a-zA-Z\.]{2,6})/', '<a href="mailto:$1">$0</a>', $input );
return $input;
}
}
......@@ -280,6 +280,7 @@
if ( flock( $fp, LOCK_SH ) ) {
fseek( $fp, $ret['header']['offset'] );
$ret['text'] = fread( $fp, $ret['header']['txtlen'] );
if ( $chrs != 'UTF-8' ) {
if ( ( $iconv = @iconv( $chrs, 'UTF-8', $ret['text'] ) ) !== false ) {
$ret['text'] = $iconv;
......
......@@ -22,9 +22,9 @@
'password' => '7c89df259c5972c13882f399878cb6e2f76899812ee15bb236a7c269298ae4d0', // SHA256 hash. Use "/bin/pwgen.php" to generate.
'origin' => 'Anything wrong with this mail? Please tell me!',
'readonly' => false,
'groups' => array( 'netmail' => '2:240/5853.1',
'test' => '2:240/5853.1',
'fidonet' => '2:240/5853.1',
'groups' => array( 'netmail' => '2:240/5853',
'test' => '2:240/5853',
'fidonet' => '2:240/5853',
'bbsnet' => '75:49/2.1',
'survnet' => '9:92/6.1',
'dorenet' => '44:49/1.1',
......
......@@ -447,6 +447,5 @@ function wordwrap( str, width, brk, cut ) {
if (!str) { return str; }
var regex = '.{1,' +width+ '}(\\s|$)' + (cut ? '|.{' +width+ '}|.+$' : '|\\S+?(\\s|$)');
console.log(regex);
return str.match( RegExp(regex, 'g') ).join( brk );
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment