[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Cypht plugin: initially render the home page instead of a 404 screen and...

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6927fc7df2cce_2a17b68c25957@gitlab-sidekiq-low-urgency-cpu-bound-v2-5df5c99858-nj29q.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
d331a616 by Merci Jacob at 2025-11-27T07:15:49+00:00
[FIX] Cypht plugin: initially render the home page instead of a 404 screen and avoid entire session clearing when server info has changed
---
* fix linter

* cache cleaning should be done per server

* [FIX] Cypht plugin: initially render the home page instead of a 404 screen and avoid entire session clearing when server info has changed

See merge request tikiwiki/tiki!9133

- - - - -


3 changed files:

- + lib/cypht/integration/Tiki_Hm_Dispatch.php
- lib/cypht/integration/classes.php
- lib/wiki-plugins/wikiplugin_cypht.php


Changes:

=====================================
lib/cypht/integration/Tiki_Hm_Dispatch.php
=====================================
@@ -0,0 +1,24 @@
+<?php
+
+// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+//
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+class Tiki_Hm_Dispatch extends Hm_Dispatch
+{
+    private bool $renderHomePage;
+
+    public function __construct($config, $renderHomePage)
+    {
+        $this->renderHomePage = $renderHomePage;
+        parent::__construct($config);
+    }
+
+    public function get_page($filters, $request)
+    {
+        if ($this->renderHomePage) {
+            $request->get['page'] = 'home';
+        }
+        return parent::get_page($filters, $request);
+    }
+}


=====================================
lib/cypht/integration/classes.php
=====================================
@@ -33,6 +33,7 @@ require_once __DIR__ . '/Tiki_Hm_User_Config.php';
 require_once __DIR__ . '/Tiki_Hm_Sieve_Custom_Client.php';
 require_once __DIR__ . '/Tiki_Hm_Sieve_Client_Factory.php';
 require_once __DIR__ . '/Tiki_Hm_Functions.php';
+require_once __DIR__ . '/Tiki_Hm_Dispatch.php';
 
 putenv('WORKER_CUSTOM_IMPORTS=' . __DIR__ . '/Tiki_Hm_User_Config.php,' . realpath(__DIR__ . '/../../core/Cache/CacheLib.php') . ',' . __DIR__ . '/Tiki_Hm_Tiki_Cache.php,' . __DIR__ . '/Tiki_Hm_Custom_Cache.php');
 


=====================================
lib/wiki-plugins/wikiplugin_cypht.php
=====================================
@@ -362,14 +362,15 @@ function wikiplugin_cypht($data, $params)
             $_SESSION[$session_prefix]['user_data']['imap_servers'] = [];
         }
         $found = false;
+        $updated = false;
         foreach ($_SESSION[$session_prefix]['user_data']['imap_servers'] as $id => $server) {
             if ($server['server'] == $attributes['server'] && $server['tls'] == $attributes['tls'] && $server['port'] == $attributes['port'] && $server['user'] == $attributes['user']) {
                 $found = true;
 
                 if (array_diff($server, $attributes)) {
                     TikiLib::lib('cache')->invalidate('imap_folders_imap_' . $id . '_');
-                    $headerlib->add_js("sessionStorage.clear();");
                     $_SESSION[$session_prefix]['user_data']['imap_servers'][$id] = array_merge($server, $attributes);
+                    $updated = true;
                 }
 
                 break;
@@ -381,6 +382,10 @@ function wikiplugin_cypht($data, $params)
             } while (isset($_SESSION[$session_prefix]['user_data']['imap_servers'][$id]));
             $_SESSION[$session_prefix]['user_data']['imap_servers'][$id] = $attributes;
         }
+
+        if ($updated) {
+            $headerlib->add_js("Hm_Folders.update_folder_list(true);");
+        }
     }
 
     if (! empty($params['smtp_server']) && ! empty($params['smtp_username']) && ! empty($params['smtp_password'])) {
@@ -415,7 +420,7 @@ function wikiplugin_cypht($data, $params)
     }
 
     /* process the request */
-    $dispatcher = new Hm_Dispatch($config);
+    $dispatcher = new Tiki_Hm_Dispatch($config, $_GET['page'] == $page);
 
     if (! empty($_SESSION[$session_prefix]['user_data']['debug_mode_setting'])) {
         $msgs = Hm_Debug::get();



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d331a616541a44a3c95b633f60ae3d36d0c7edbc

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d331a616541a44a3c95b633f60ae3d36d0c7edbc
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.