changeset 11:aff04b06b685 default tip

various small fixes from upgrades to PHP and/or hangover from fix to apt-get overwrite at beginning of the year somehow
author Charlie Root
date Sun, 26 Jan 2025 13:09:03 -0500
parents 8e3cc6fc791d
children
files program/lib/Roundcube/html.php program/lib/Roundcube/rcube_contacts.php program/lib/Roundcube/rcube_db.php program/lib/Roundcube/rcube_imap_generic.php program/lib/Roundcube/rcube_vcard.php program/steps/mail/sendmail.inc
diffstat 6 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/program/lib/Roundcube/html.php	Mon May 11 16:56:46 2020 -0400
+++ b/program/lib/Roundcube/html.php	Sun Jan 26 13:09:03 2025 -0500
@@ -751,7 +751,12 @@
         $cell->attrib  = $attr;
         $cell->content = $cont;
 
-        $this->rows[$this->rowindex]->cells[$this->colindex] = $cell;
+	// make sure row object exists (#1489094)
+        if (!$this->rows[$this->rowindex]) {
+            $this->rows[$this->rowindex] = new stdClass;
+        }
+
+       $this->rows[$this->rowindex]->cells[$this->colindex] = $cell;
         $this->colindex += max(1, intval($attr['colspan']));
 
         if ($this->attrib['cols'] && $this->colindex >= $this->attrib['cols']) {
--- a/program/lib/Roundcube/rcube_contacts.php	Mon May 11 16:56:46 2020 -0400
+++ b/program/lib/Roundcube/rcube_contacts.php	Sun Jan 26 13:09:03 2025 -0500
@@ -356,7 +356,7 @@
         if (!empty($post_search) || !empty($required)) {
             $ids = array(0);
             // build key name regexp
-            $regexp = '/^(' . implode(array_keys($post_search), '|') . ')(?:.*)$/';
+            $regexp = '/^(' . implode('|', array_keys($post_search)) . ')(?:.*)$/';
             // use initial WHERE clause, to limit records number if possible
             if (!empty($where))
                 $this->set_search_set($where);
--- a/program/lib/Roundcube/rcube_db.php	Mon May 11 16:56:46 2020 -0400
+++ b/program/lib/Roundcube/rcube_db.php	Sun Jan 26 13:09:03 2025 -0500
@@ -914,7 +914,7 @@
             $name[] = $start . $elem . $end;
         }
 
-        return implode($name, '.');
+        return implode('.',$name);
     }
 
     /**
--- a/program/lib/Roundcube/rcube_imap_generic.php	Mon May 11 16:56:46 2020 -0400
+++ b/program/lib/Roundcube/rcube_imap_generic.php	Sun Jan 26 13:09:03 2025 -0500
@@ -3899,9 +3899,18 @@
 
         $result = array();
         $start  = $prev = $messages[0];
+	$needStrip = (strpos($start,'_') !== false);	  
 
         foreach ($messages as $id) {
-            $incr = $id - $prev;
+	    #rcube::write_log('mail',"non-num? id: |$id|, prev: |$prev|");
+            #Advanced search calls with pseudo-message-ids?  Non-numeric, anyway, e.g.
+	    # 420__MB__97ce7451bd364b47894f71ba7eb8ceb1
+	    if ($needStrip) {
+	      $incr = substr($id,0,strpos($id,'_')) - substr($prev,0,strpos($prev,'_'));
+	    }
+	    else {
+	      $incr = $id - $prev;
+	    }
             if ($incr > 1) { // found a gap
                 if ($start == $prev) {
                     $result[] = $prev; // push single id
--- a/program/lib/Roundcube/rcube_vcard.php	Mon May 11 16:56:46 2020 -0400
+++ b/program/lib/Roundcube/rcube_vcard.php	Sun Jan 26 13:09:03 2025 -0500
@@ -525,14 +525,14 @@
     {
         // convert Apple X-ABRELATEDNAMES into X-* fields for better compatibility
         $vcard = preg_replace_callback(
-            '/item(\d+)\.(X-ABRELATEDNAMES)([^:]*?):(.*?)item\1.X-ABLabel:(?:_\$!<)?([\w-() ]*)(?:>!\$_)?./s',
+            '/item(\d+)\.(X-ABRELATEDNAMES)([^:]*?):(.*?)item\1.X-ABLabel:(?:_\$!<)?([\w\-() ]*)(?:>!\$_)?./s',
             array('self', 'x_abrelatednames_callback'),
             $vcard);
 
         // Cleanup
         $vcard = preg_replace(array(
                 // convert special types (like Skype) to normal type='skype' classes with this simple regex ;)
-                '/item(\d+)\.(TEL|EMAIL|URL)([^:]*?):(.*?)item\1.X-ABLabel:(?:_\$!<)?([\w-() ]*)(?:>!\$_)?./si',
+                '/item(\d+)\.(TEL|EMAIL|URL)([^:]*?):(.*?)item\1.X-ABLabel:(?:_\$!<)?([\w\-() ]*)(?:>!\$_)?./si',
                 '/^item\d*\.X-AB.*$/mi',  // remove cruft like item1.X-AB*
                 '/^item\d*\./mi',         // remove item1.ADR instead of ADR
                 '/\n+/',                 // remove empty lines
--- a/program/steps/mail/sendmail.inc	Mon May 11 16:56:46 2020 -0400
+++ b/program/steps/mail/sendmail.inc	Sun Jan 26 13:09:03 2025 -0500
@@ -889,7 +889,7 @@
         else if (preg_match('/<*'.$email_regexp.'>*$/', $item, $matches)) {
             $address = $matches[0];
             $name    = trim(str_replace($address, '', $item));
-            if ($name[0] == '"' && $name[count($name)-1] == '"') {
+            if ($name[0] == '"' && $name[strlen($name)-1] == '"') {
                 $name = substr($name, 1, -1);
             }
             $name     = stripcslashes($name);