From 67b146bb78dec828d416a96d4ebcbef7d4192dd4 Mon Sep 17 00:00:00 2001 From: GabrielBragaGit <65824599+GabrielBragaGit@users.noreply.github.com> Date: Sun, 29 Dec 2024 07:18:27 -0300 Subject: [PATCH 01/24] Bug Fix: Resolve Callback Issue in Email Parsing #### Description Fixed an issue with array_walk callback by using the class method as a callback. #### Details - Modified the code to use `[$this, 'tln_casenormalize']` instead of a global function call - Ensures the case normalization method is correctly called within the class context - Prevents undefined function errors during email parsing #### Code Change ```php // Before @array_walk($tag_list, 'tln_casenormalize'); @array_walk($rm_tags_with_content, 'tln_casenormalize'); @array_walk($self_closing_tags, 'tln_casenormalize'); // After @array_walk($tag_list, [$this, 'tln_casenormalize']); @array_walk($rm_tags_with_content, [$this, 'tln_casenormalize']); @array_walk($self_closing_tags, [$this, 'tln_casenormalize']); --- packages/Webkul/Email/src/Helpers/Htmlfilter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/Webkul/Email/src/Helpers/Htmlfilter.php b/packages/Webkul/Email/src/Helpers/Htmlfilter.php index 76404b722..6dd744cd9 100644 --- a/packages/Webkul/Email/src/Helpers/Htmlfilter.php +++ b/packages/Webkul/Email/src/Helpers/Htmlfilter.php @@ -939,11 +939,11 @@ public function tln_sanitize( */ $rm_tags = array_shift($tag_list); - @array_walk($tag_list, 'tln_casenormalize'); + @array_walk($tag_list, [$this, 'tln_casenormalize']); - @array_walk($rm_tags_with_content, 'tln_casenormalize'); + @array_walk($rm_tags_with_content, [$this, 'tln_casenormalize']); - @array_walk($self_closing_tags, 'tln_casenormalize'); + @array_walk($self_closing_tags, [$this, 'tln_casenormalize']); /** * See if tag_list is of tags to remove or tags to allow. From e66d964c7d767c3b2722f66a76a690a0625a2075 Mon Sep 17 00:00:00 2001 From: GabrielBragaGit <65824599+GabrielBragaGit@users.noreply.github.com> Date: Mon, 30 Dec 2024 00:01:59 -0300 Subject: [PATCH 02/24] Modernization: Replace Deprecated `each()` Function #### Description Updated `tln_fixatts` method to use modern PHP iteration syntax, removing deprecated `each()` function. #### Details - Replaced `each()` with `foreach` loop - Added type safety for input array - Maintained original method logic - Ensures compatibility with PHP 7.2+ and PHP 8.0+ - Improved loop control with `continue 2` #### Code Change ```php // Before while ([$attname, $attvalue] = each($attary)) { // Processing logic } // After foreach ($attary as $attname => $attvalue) { // Processing logic with continue 2 } ### Rationale - each() function is deprecated and removed in newer PHP versions - foreach provides a more modern and readable way to iterate arrays - continue 2 ensures proper loop control when removing attributes - Immediately exits both inner and outer loops - Prevents unnecessary iteration after attribute removal - Improves code maintainability and compatibility ### Loop Control Explanation - Simple continue would only exit the inner loop - continue 2 completely exits nested loops - Ensures we move to the next attribute after removal - Prevents potential side effects of partial loop execution --- packages/Webkul/Email/src/Helpers/Htmlfilter.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/Email/src/Helpers/Htmlfilter.php b/packages/Webkul/Email/src/Helpers/Htmlfilter.php index 76404b722..73bd48afc 100644 --- a/packages/Webkul/Email/src/Helpers/Htmlfilter.php +++ b/packages/Webkul/Email/src/Helpers/Htmlfilter.php @@ -560,7 +560,12 @@ public function tln_fixatts( $trans_image_path, $block_external_images ) { - while ([$attname, $attvalue] = each($attary)) { + /** + * Convert to array if is not + */ + $attary = is_array($attary) ? $attary : []; + + foreach ($attary as $attname => $attvalue) { /** * See if this attribute should be removed. */ @@ -570,7 +575,7 @@ public function tln_fixatts( if (preg_match($matchattr, $attname)) { unset($attary[$attname]); - continue; + continue 2; } } } From a31b124bd5af1fc44a05a46d81bbd270e607a9d8 Mon Sep 17 00:00:00 2001 From: GabrielBragaGit <65824599+GabrielBragaGit@users.noreply.github.com> Date: Mon, 30 Dec 2024 00:06:30 -0300 Subject: [PATCH 03/24] Bug Fix: Prevent Count Error in tln_skipspace Method #### Description Fixed a potential type error when checking for whitespace in email parsing. #### Details - Modified `tln_skipspace` method to handle string inputs safely - Prevents "count() must be of type Countable|array" error - Maintains original logic of skipping whitespace #### Code Change ```php // Before if (count($matches[1])) { $count = strlen($matches[1]); $offset += $count; } // After if (!empty($matches[1])) { $count = strlen($matches[1]); $offset += $count; } ``` ### Rationale - Original code assumed $matches[1] would always be an array - New implementation checks for non-empty value before processing - Improves error handling and type safety --- packages/Webkul/Email/src/Helpers/Htmlfilter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/Email/src/Helpers/Htmlfilter.php b/packages/Webkul/Email/src/Helpers/Htmlfilter.php index 76404b722..91458a4ce 100644 --- a/packages/Webkul/Email/src/Helpers/Htmlfilter.php +++ b/packages/Webkul/Email/src/Helpers/Htmlfilter.php @@ -56,7 +56,7 @@ public function tln_skipspace($body, $offset) preg_match('/^(\s*)/s', substr($body, $offset), $matches); try { - if (count($matches[1])) { + if (!empty($matches[1])) { $count = strlen($matches[1]); $offset += $count; } From e2fd7bf2fca11c63675bdfd8845ade3be5f89045 Mon Sep 17 00:00:00 2001 From: GabrielBragaGit <65824599+GabrielBragaGit@users.noreply.github.com> Date: Mon, 30 Dec 2024 00:12:17 -0300 Subject: [PATCH 04/24] Modernization: Replace Deprecated `each()` Function in `tln_tagprint` #### Description Updated `tln_tagprint` method to use modern PHP iteration syntax, removing deprecated `each()` function. #### Details - Replaced `each()` with `foreach` loop - Simplified array population method - Maintained original method logic - Ensures compatibility with PHP 7.2+ and PHP 8.0+ #### Code Change ```php // Before while ([$attname, $attvalue] = each($attary)) { array_push($atts, "$attname=$attvalue"); } // After foreach ($attary as $attname => $attvalue) { $atts[] = "$attname=$attvalue"; } ``` ### Rationale - #each() function is deprecated and removed in newer PHP versions - #foreach provides a more modern and readable way to iterate arrays - #$atts[] is a more concise way to add elements to an array compared to #array_push() - Improves code maintainability and compatibility --- packages/Webkul/Email/src/Helpers/Htmlfilter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/Email/src/Helpers/Htmlfilter.php b/packages/Webkul/Email/src/Helpers/Htmlfilter.php index 76404b722..dc65745e8 100644 --- a/packages/Webkul/Email/src/Helpers/Htmlfilter.php +++ b/packages/Webkul/Email/src/Helpers/Htmlfilter.php @@ -13,8 +13,8 @@ public function tln_tagprint($tagname, $attary, $tagtype) if (is_array($attary) && count($attary)) { $atts = []; - while ([$attname, $attvalue] = each($attary)) { - array_push($atts, "$attname=$attvalue"); + foreach ($attary as $attname => $attvalue) { + $atts[] = "$attname=$attvalue"; } $fulltag .= ' '.implode(' ', $atts); From b79722c13dae256fc877174b6b2b123360582546 Mon Sep 17 00:00:00 2001 From: GabrielBragaGit <65824599+GabrielBragaGit@users.noreply.github.com> Date: Mon, 30 Dec 2024 06:59:26 -0300 Subject: [PATCH 05/24] Fix an error where the email parser would fail when processing certain email parts due to missing 'from' headers in multipart messages. ### Problem When processing multipart email messages, some parts (particularly nested ones) don't contain their own headers. This was causing an "Undefined array key 'from'" error when the code attempted to access the 'from' header directly. ### Solution - Added header existence validation before accessing the 'from' field - Implemented fallback to parent part headers when child part headers are missing - Added graceful continuation of processing when headers cannot be found ### Changes ```php // Before $part_from_sender = is_array($part['headers']['from']) ? $part['headers']['from'][0] : $part['headers']['from']; // After if (empty($part['headers']) || !isset($part['headers']['from'])) { $parentKey = explode('.', $key)[0]; if (isset($this->parts[$parentKey]) && isset($this->parts[$parentKey]['headers']['from'])) { $part_from_sender = is_array($this->parts[$parentKey]['headers']['from']) ? $this->parts[$parentKey]['headers']['from'][0] : $this->parts[$parentKey]['headers']['from']; } else { continue; } } else { $part_from_sender = is_array($part['headers']['from']) ? $part['headers']['from'][0] : $part['headers']['from']; } ``` --- packages/Webkul/Email/src/Helpers/Parser.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/Webkul/Email/src/Helpers/Parser.php b/packages/Webkul/Email/src/Helpers/Parser.php index a21f97cf7..e7c4c9f62 100644 --- a/packages/Webkul/Email/src/Helpers/Parser.php +++ b/packages/Webkul/Email/src/Helpers/Parser.php @@ -356,7 +356,20 @@ public function getMessageBody($type = 'text') $textBody .= $this->decodeContentTransfer($this->getPartBody($part), $encodingType); $textBody = nl2br($this->charset->decodeCharset($textBody, $this->getPartCharset($part))); } elseif ($this->getPart('content-type', $part) == 'text/plain; (error)') { - $part_from_sender = is_array($part['headers']['from']) ? $part['headers']['from'][0] : $part['headers']['from']; + if (empty($part['headers']) || !isset($part['headers']['from'])) { + $parentKey = explode('.', $key)[0]; + if (isset($this->parts[$parentKey]) && isset($this->parts[$parentKey]['headers']['from'])) { + $part_from_sender = is_array($this->parts[$parentKey]['headers']['from']) + ? $this->parts[$parentKey]['headers']['from'][0] + : $this->parts[$parentKey]['headers']['from']; + } else { + continue; + } + } else { + $part_from_sender = is_array($part['headers']['from']) + ? $part['headers']['from'][0] + : $part['headers']['from']; + } $mail_part_addresses = mailparse_rfc822_parse_addresses($part_from_sender); if (! empty($mail_part_addresses[0]['address']) From 17980dac1837fe60afeb7fda58fcc7a42771ff2f Mon Sep 17 00:00:00 2001 From: amit kumar laravel Date: Tue, 31 Dec 2024 10:40:14 +0530 Subject: [PATCH 06/24] Fixed Issue #1917 --- .../Admin/src/Resources/views/activities/index.blade.php | 5 +++-- .../Webkul/Admin/src/Resources/views/leads/create.blade.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/Webkul/Admin/src/Resources/views/activities/index.blade.php b/packages/Webkul/Admin/src/Resources/views/activities/index.blade.php index 3ffc0e550..389a2c694 100644 --- a/packages/Webkul/Admin/src/Resources/views/activities/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/activities/index.blade.php @@ -221,7 +221,8 @@ class="text-gray-600 dark:text-gray-300"

- @{{ record.comment }} + {{-- @{{ record.comment }} --}} + @{{ record.comment.length > 180 ? record.comment.slice(0, 180) + '...' : record.comment }}

@@ -232,7 +233,7 @@ class="text-gray-600 dark:text-gray-300"
-
+

@{{ record.schedule_from ?? 'N/A' }} diff --git a/packages/Webkul/Admin/src/Resources/views/leads/create.blade.php b/packages/Webkul/Admin/src/Resources/views/leads/create.blade.php index d21a8c86a..ecc39c37f 100644 --- a/packages/Webkul/Admin/src/Resources/views/leads/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/leads/create.blade.php @@ -121,7 +121,7 @@ class="flex flex-col gap-4" ]" /> - +

Date: Tue, 31 Dec 2024 11:41:45 +0530 Subject: [PATCH 07/24] Fix Pint Issue. --- .../Webkul/Email/src/Helpers/Htmlfilter.php | 186 ++++++------------ 1 file changed, 60 insertions(+), 126 deletions(-) diff --git a/packages/Webkul/Email/src/Helpers/Htmlfilter.php b/packages/Webkul/Email/src/Helpers/Htmlfilter.php index 76404b722..45b277564 100644 --- a/packages/Webkul/Email/src/Helpers/Htmlfilter.php +++ b/packages/Webkul/Email/src/Helpers/Htmlfilter.php @@ -61,7 +61,6 @@ public function tln_skipspace($body, $offset) $offset += $count; } } catch (\Exception $e) { - // Do nothing ... } return $offset; @@ -171,6 +170,7 @@ public function tln_getnxtag($body, $offset) switch (substr($body, $pos, 1)) { case '/': $tagtype = 2; + $pos++; break; @@ -196,12 +196,9 @@ public function tln_getnxtag($body, $offset) break; default: - /** - * Assume tagtype 1 for now. If it's type 3, we'll switch values - * later. - */ $tagtype = 1; break; + } /** @@ -238,11 +235,14 @@ public function tln_getnxtag($body, $offset) $tagtype = 3; } else { $gt = $this->tln_findnxstr($body, $pos, '>'); + $retary = [false, false, false, $lt, $gt]; return $retary; } + break; + //intentional fall-through case '>': return [$tagname, false, $tagtype, $lt, $pos]; @@ -296,6 +296,7 @@ public function tln_getnxtag($body, $offset) if ($matches[2] == '/>') { $tagtype = 3; + $pos++; } @@ -357,6 +358,8 @@ public function tln_getnxtag($body, $offset) return $retary; } + break; + //intentional fall-through case '>': $attary[$attname] = '"yes"'; @@ -427,22 +430,13 @@ public function tln_getnxtag($body, $offset) [$pos, $attval, $match] = $regary; - /** - * If it's ">" it will be caught at the top. - */ $attval = preg_replace('/\"/s', '"', $attval); $attary[$attname] = '"'.$attval.'"'; } } elseif (preg_match('|[\w/>]|', $char)) { - /** - * That was attribute type 4. - */ $attary[$attname] = '"yes"'; } else { - /** - * An illegal character. Find next '>' and return. - */ $gt = $this->tln_findnxstr($body, $pos, '>'); return [false, false, false, $lt, $gt]; @@ -576,18 +570,8 @@ public function tln_fixatts( } } - /** - * Remove any backslashes, entities, or extraneous whitespace. - */ - $oldattvalue = $attvalue; - $this->tln_defang($attvalue); - // if ($attname == 'style' && $attvalue !== $oldattvalue) { - // $attvalue = "idiocy"; - // $attary{$attname} = $attvalue; - // } - $this->tln_unspace($attvalue); /** @@ -600,11 +584,6 @@ public function tln_fixatts( if (preg_match($matchtag, $tagname)) { foreach ($matchattrs as $matchattr => $valary) { if (preg_match($matchattr, $attname)) { - /** - * There are two arrays in valary. - * First is matches. - * Second one is replacements - */ [$valmatch, $valrepl] = $valary; $newvalue = preg_replace($valmatch, $valrepl, $attvalue); @@ -617,20 +596,6 @@ public function tln_fixatts( } } } - - // if ($attname == 'style') { - // if (preg_match('/[\0-\37\200-\377]+/', $attvalue)) { - // $attary{$attname} = '"disallowed character"'; - // } - // preg_match_all("/url\s*\((.+)\)/si", $attvalue, $aMatch); - // if (count($aMatch)) { - // foreach($aMatch[1] as $sMatch) { - // $urlvalue = $sMatch; - // $this->tln_fixurl($attname, $urlvalue, $trans_image_path, $block_external_images); - // $attary{$attname} = str_replace($sMatch, $urlvalue, $attvalue); - // } - // } - // } } /** @@ -677,6 +642,7 @@ public function tln_fixurl($attname, &$attvalue, $trans_image_path, $block_exter default: $attvalue = $sQuote.$trans_image_path.$sQuote; break; + } } else { $aUrl = parse_url($attvalue); @@ -699,12 +665,15 @@ public function tln_fixurl($attname, &$attvalue, $trans_image_path, $block_exter $attvalue = $sQuote.$attvalue.$sQuote; } break; + case 'outbind': $attvalue = $sQuote.$attvalue.$sQuote; break; + case 'cid': $attvalue = $sQuote.$attvalue.$sQuote; break; + default: $attvalue = $sQuote.$trans_image_path.$sQuote; break; @@ -722,9 +691,6 @@ public function tln_fixstyle($body, $pos, $trans_image_path, $block_external_ima { $me = 'tln_fixstyle'; - // workaround for in between comments - $iCurrentPos = $pos; - $content = ''; $sToken = ''; @@ -743,21 +709,29 @@ public function tln_fixstyle($body, $pos, $trans_image_path, $block_external_ima case '/': if ($sToken == '<') { $sToken .= $char; + $bEndTag = true; } else { $content .= $char; } + break; + case '>': if ($bEndTag) { $sToken .= $char; + if (preg_match('/\<\/\s*style\s*\>/i', $sToken, $aMatch)) { $newpos = $i + 1; + $bSucces = true; + break 2; + } else { $content .= $sToken; } + $bEndTag = false; } else { $content .= $char; @@ -765,12 +739,13 @@ public function tln_fixstyle($body, $pos, $trans_image_path, $block_external_ima break; case '!': if ($sToken == '<') { - // possible comment if (isset($body[$i + 2]) && substr($body, $i, 3) == '!--') { $i = strpos($body, '-->', $i + 3); - if ($i === false) { // no end comment + + if (! $i) { $i = strlen($body); } + $sToken = ''; } } else { @@ -787,7 +762,7 @@ public function tln_fixstyle($body, $pos, $trans_image_path, $block_external_ima } } - if ($bSucces == false) { + if (! $bSucces) { return [false, strlen($body)]; } @@ -801,12 +776,6 @@ public function tln_fixstyle($body, $pos, $trans_image_path, $block_external_ima $trans_image_path = $trans_image_path; - /** - * Fix url('blah') declarations. - */ - // $content = preg_replace("|url\s*\(\s*([\'\"])\s*\S+script\s*:.*?([\'\"])\s*\)|si", - // "url(\\1$trans_image_path\\2)", $content); - // first check for 8bit sequences and disallowed control characters if (preg_match('/[\16-\37\200-\377]+/', $content)) { $content = ''; @@ -825,7 +794,6 @@ public function tln_fixstyle($body, $pos, $trans_image_path, $block_external_ima $aValue = $aReplace = []; foreach ($aMatch[1] as $sMatch) { - // url value $urlvalue = $sMatch; $this->tln_fixurl('style', $urlvalue, $trans_image_path, $block_external_images); $aValue[] = $sMatch; @@ -868,8 +836,6 @@ public function tln_body2div($attary, $trans_image_path) $divattary = ['class' => "'bodyclass'"]; - $text = '#000000'; - $has_bgc_stl = $has_txt_stl = false; $styledef = ''; @@ -884,21 +850,25 @@ public function tln_body2div($attary, $trans_image_path) case 'background': $styledef .= "background-image: url('$trans_image_path'); "; break; + case 'bgcolor': $has_bgc_stl = true; + $styledef .= "background-color: $attvalue; "; break; + case 'text': $has_txt_stl = true; + $styledef .= "color: $attvalue; "; break; + } } - // Outlook defines a white bgcolor and no text color. This can lead to - // white text on a white bg with certain themes. + // Outlook defines a white bgcolor and no text color. This can lead to white text on a white bg with certain themes. if ($has_bgc_stl && ! $has_txt_stl) { - $styledef .= "color: $text; "; + $styledef .= 'color: #000000; '; } if (strlen($styledef) > 0) { @@ -1003,9 +973,6 @@ public function tln_sanitize( if ($tagname != false) { if ($tagtype == 2) { if ($skip_content == $tagname) { - /** - * Got to the end of tag we needed to remove. - */ $tagname = false; $skip_content = false; @@ -1025,15 +992,9 @@ public function tln_sanitize( } } } else { - /** - * $rm_tags_with_content - */ - if ($skip_content == false) { - /** - * See if this is a self-closing type and change - * tagtype appropriately. - */ - if ($tagtype == 1 + if (! $skip_content) { + if ( + $tagtype == 1 && in_array($tagname, $self_closing_tags) ) { $tagtype = 3; @@ -1043,15 +1004,19 @@ public function tln_sanitize( * See if we should skip this tag and any content * inside it. */ - if ($tagtype == 1 + if ( + $tagtype == 1 && in_array($tagname, $rm_tags_with_content) ) { $skip_content = $tagname; } else { - if (($rm_tags == false - && in_array($tagname, $tag_list)) || - ($rm_tags == true - && ! in_array($tagname, $tag_list)) + if (( + ! $rm_tags + && in_array($tagname, $tag_list)) + || ( + $rm_tags + && ! in_array($tagname, $tag_list) + ) ) { $tagname = false; } else { @@ -1114,9 +1079,14 @@ public function tln_sanitize( return $trusted; } - // - // Use the nifty htmlfilter library - // + /** + * Use the nifty htmlfilter library + * + * @param mixed $body + * @param mixed $trans_image_path + * @param mixed $block_external_images + * @return string + */ public function HTMLFilter($body, $trans_image_path, $block_external_images = false) { $tag_list = [ @@ -1155,12 +1125,10 @@ public function HTMLFilter($body, $trans_image_path, $block_external_images = fa $rm_attnames = [ '/.*/' => [ - // "/target/i", '/^on.*/i', '/^dynsrc/i', '/^data.*/i', '/^lowsrc.*/i', - // "/^style/i", ], ]; @@ -1171,54 +1139,24 @@ public function HTMLFilter($body, $trans_image_path, $block_external_images = fa '/^([\'"])\s*\S+script\s*:.*([\'"])/si', '/^([\'"])\s*mocha\s*:*.*([\'"])/si', '/^([\'"])\s*about\s*:.*([\'"])/si', - ], - [ + ], [ "\\1$trans_image_path\\2", "\\1$trans_image_path\\2", "\\1$trans_image_path\\2", ], ], + '/^href|action/i' => [ [ '/^([\'"])\s*\S+script\s*:.*([\'"])/si', '/^([\'"])\s*mocha\s*:*.*([\'"])/si', '/^([\'"])\s*about\s*:.*([\'"])/si', - ], - [ + ], [ '\\1#\\1', '\\1#\\1', '\\1#\\1', ], ], - // "/^style/i" => - // array( - // array( - // "/\/\*.*\*\//", - // "/expression/i", - // "/binding/i", - // "/behaviou*r/i", - // "/include-source/i", - // '/position\s*:/i', - // '/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i', - // '/url\s*\(\s*([\'"])\s*\S+script\s*:.*([\'"])\s*\)/si', - // '/url\s*\(\s*([\'"])\s*mocha\s*:.*([\'"])\s*\)/si', - // '/url\s*\(\s*([\'"])\s*about\s*:.*([\'"])\s*\)/si', - // '/(.*)\s*:\s*url\s*\(\s*([\'"]*)\s*\S+script\s*:.*([\'"]*)\s*\)/si' - // ), - // array( - // "", - // "idiocy", - // "idiocy", - // "idiocy", - // "idiocy", - // "idiocy", - // "url", - // "url(\\1#\\1)", - // "url(\\1#\\1)", - // "url(\\1#\\1)", - // "\\1:url(\\2#\\3)" - // ) - // ) ], ]; @@ -1232,14 +1170,6 @@ public function HTMLFilter($body, $trans_image_path, $block_external_images = fa $bad_attvals['/.*/']['/^src|background/i'][1], "\\1$trans_image_path\\1" ); - // array_push( - // $bad_attvals{'/.*/'}{'/^style/i'}[0], - // '/url\(([\'\"])\s*https*:.*([\'\"])\)/si' - // ); - // array_push( - // $bad_attvals{'/.*/'}{'/^style/i'}[1], - // "url(\\1$trans_image_path\\1)" - // ); } $add_attr_to_tag = [ @@ -1268,12 +1198,16 @@ public function AutoLinkUrls($str, $popup = false) if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches)) { $pop = ($popup == true) ? ' target="_blank" ' : ''; + for ($i = 0; $i < count($matches['0']); $i++) { $period = ''; + if (preg_match("|\.$|", $matches['6'][$i])) { $period = '.'; + $matches['6'][$i] = substr($matches['6'][$i], 0, -1); } + $str = str_replace($matches['0'][$i], $matches['1'][$i].'stream = &$tmp_fp; } else { throw new \Exception( - 'Could not create temporary files for attachments. Your tmp directory may be unwritable by PHP.' + 'Could not create temporary files for attachments. Your tmp directory may be un-writable by PHP.' ); } @@ -161,8 +166,6 @@ public function setText($data) * Parse the Message into parts * * @return void - * - * @private */ private function parse() { @@ -501,7 +504,7 @@ public function getAttachments() && ! strpos($this->getPart('content-type', $part), 'image/') && ! stripos($filename, 'noname') == false ) { - //skip + // skip } else { $attachments[] = new Attachment( $filename, @@ -710,7 +713,7 @@ private function decodeContentTransfer($encodedString, $encodingType) */ private function decodeHeader($input) { - //Sometimes we have 2 label From so we take only the first + // Sometimes we have 2 label From so we take only the first if (is_array($input)) { return $this->decodeSingleHeader($input[0]); } diff --git a/packages/Webkul/Email/src/Repositories/EmailRepository.php b/packages/Webkul/Email/src/Repositories/EmailRepository.php index fadc641bf..c15ba011c 100644 --- a/packages/Webkul/Email/src/Repositories/EmailRepository.php +++ b/packages/Webkul/Email/src/Repositories/EmailRepository.php @@ -153,7 +153,7 @@ public function processInboundParseMail($content) if (! isset($email)) { $email = $this->create(array_merge($headers, [ 'folders' => ['inbox'], - 'reply' => $reply, //$this->htmlFilter->HTMLFilter($reply, ''), + 'reply' => $reply, // $this->htmlFilter->HTMLFilter($reply, ''), 'unique_id' => time().'@'.config('mail.domain'), 'reference_ids' => [$headers['message_id']], 'user_type' => 'person', From 501ac052b949cd5d45fd5a179b441dcf976ec07c Mon Sep 17 00:00:00 2001 From: amit kumar laravel Date: Tue, 31 Dec 2024 11:52:31 +0530 Subject: [PATCH 09/24] Fixed isse. --- packages/Webkul/Email/src/Helpers/Parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/Email/src/Helpers/Parser.php b/packages/Webkul/Email/src/Helpers/Parser.php index 1ec70b744..472ebc9de 100644 --- a/packages/Webkul/Email/src/Helpers/Parser.php +++ b/packages/Webkul/Email/src/Helpers/Parser.php @@ -701,7 +701,7 @@ private function decodeContentTransfer($encodedString, $encodingType) } elseif ($encodingType == 'quoted-printable') { return quoted_printable_decode($encodedString); } else { - return $encodedString; //8bit, 7bit, binary + return $encodedString; // 8bit, 7bit, binary } } From 494deb2264377fefc21e7ec2a6f8f1019a836b94 Mon Sep 17 00:00:00 2001 From: amit kumar laravel Date: Tue, 31 Dec 2024 16:51:19 +0530 Subject: [PATCH 10/24] Fixed Issue #1914 --- .../Webkul/Attribute/src/Repositories/AttributeRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php b/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php index 44ee53561..4f544a48e 100755 --- a/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php +++ b/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php @@ -128,11 +128,11 @@ public function getLookUpOptions($lookup, $query = '', $columns = []) $currentUser = auth()->guard('user')->user(); - if ($currentUser->view_permission === 'group') { + if ($currentUser?->view_permission === 'group') { return $userRepository->leftJoin('user_groups', 'users.id', '=', 'user_groups.user_id') ->where('users.name', 'like', '%'.urldecode($query).'%') ->get(); - } elseif ($currentUser->view_permission === 'individual') { + } elseif ($currentUser?->view_permission === 'individual') { return $userRepository->where('users.id', $currentUser->id); } From ee20c5e6cfb55bea2e97ed59fef19f9e734ffa53 Mon Sep 17 00:00:00 2001 From: amit kumar laravel Date: Tue, 31 Dec 2024 17:26:16 +0530 Subject: [PATCH 11/24] Added Suggestion #1763 --- .../views/settings/pipelines/edit.blade.php | 41 ++++++++----------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/packages/Webkul/Admin/src/Resources/views/settings/pipelines/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/settings/pipelines/edit.blade.php index 69ad1df14..97b284373 100644 --- a/packages/Webkul/Admin/src/Resources/views/settings/pipelines/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/settings/pipelines/edit.blade.php @@ -148,10 +148,7 @@ class="cursor-pointer" class="flex gap-4" >