This patch for Tavi 0.26 fixes the "Notice: A session had already been started - ignoring session_start() in tavi/action/preview.php on line 19" warning message which appears in "Previewing" page shown after a wrong Captcha code is entered into "Editing" page if $UseCaptcha is enabled. --BorutRazem

What the patch modifies

How the patch works

The patch


diff -ruN tavi-current/action/edit.php tavi-my/action/edit.php
--- tavi/action/edit.php	2005-03-29 21:27:44.000000000 +0200
+++ tavi-my/action/edit.php	2005-11-30 20:01:27.250000000 +0100
@@ -40,8 +40,10 @@
     }
   
     // Store ASCII Art phrase in session variable 
-    session_name("taviCaptcha");
-    session_start();
+    if (!isset($_SESSION)) {
+      session_name("taviCaptcha");
+      session_start();
+    }
     $_SESSION['captcha_phrase'] = $aphrase_orig;
     $_SESSION['captcha_image'] = $aphrase_ascii;
   } else {
diff -ruN tavi/action/preview.php tavi-my/action/preview.php
--- tavi/action/preview.php	2005-03-29 21:27:44.000000000 +0200
+++ tavi-my/action/preview.php	2005-11-30 20:01:25.781250000 +0100
@@ -15,9 +15,10 @@
 
   if ($UseCaptcha) {
     // Restore/start session 
-    session_name("taviCaptcha");
-    session_start();
-    
+    if (!isset($_SESSION)) {
+      session_name("taviCaptcha");
+      session_start();
+    }
     if ($_SESSION['captcha_phrase']) {
       $captcha = $_SESSION['captcha_image'];
     } else {
diff -ruN tavi/action/save.php tavi-my/action/save.php
--- tavi/action/save.php	2005-03-29 21:27:44.000000000 +0200
+++ tavi-my/action/save.php	2005-11-30 20:01:28.015625000 +0100
@@ -24,8 +24,10 @@
   // window! 
   if ($UseCaptcha) {
     // Restore/start session 
-    session_name("taviCaptcha");
-    session_start();
+    if (!isset($_SESSION)) {
+      session_name("taviCaptcha");
+      session_start();
+    }
     if ((!$_SESSION['captcha_phrase']) or
         ($_SESSION['captcha_phrase'] != strtoupper($posted_code))) 
       {