Fix #8135 - fixes to image captcha
authorAlan <alan@roojs.com>
Fri, 12 Apr 2024 08:18:42 +0000 (16:18 +0800)
committerAlan <alan@roojs.com>
Fri, 12 Apr 2024 08:18:42 +0000 (16:18 +0800)
DB/DataObject.php
Image/Text.php
Text/CAPTCHA.php
Text/CAPTCHA/Driver/Image.php

index 0a15be4..dcb01bd 100644 (file)
@@ -4085,7 +4085,7 @@ class DB_DataObject extends DB_DataObject_Overload
      * @access   public
      */
     function autoJoin($cfg = array())
-    {
+    { 
         global $_DB_DATAOBJECT;
         //var_Dump($cfg);exit;
         $pre_links = $this->links();
@@ -4172,8 +4172,7 @@ class DB_DataObject extends DB_DataObject_Overload
             if (!isset($dbstructure[$tab])) {
                 continue;
             }
-            
-            if (!empty($cfg['exclude']) && in_array($tab .'.*', $cfg['exclude'])) {
+             if (!empty($cfg['exclude']) && in_array($tab .'.*', $cfg['exclude'])) {
                 continue;
             }
             
index f7e2f46..223775d 100644 (file)
@@ -85,42 +85,42 @@ require_once 'PEAR.php';
 /**
  * Regex to match HTML style hex triples.
  */
-define("IMAGE_TEXT_REGEX_HTMLCOLOR", "/^[#|]([a-f0-9]{2})?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i", true);
+define("IMAGE_TEXT_REGEX_HTMLCOLOR", "/^[#|]([a-f0-9]{2})?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i");
 
 /**
  * Defines horizontal alignment to the left of the text box. (This is standard.)
  */
-define("IMAGE_TEXT_ALIGN_LEFT", "left", true);
+define("IMAGE_TEXT_ALIGN_LEFT", "left");
 
 /**
  * Defines horizontal alignment to the center of the text box.
  */
-define("IMAGE_TEXT_ALIGN_RIGHT", "right", true);
+define("IMAGE_TEXT_ALIGN_RIGHT", "right");
 
 /**
  * Defines horizontal alignment to the center of the text box.
  */
-define("IMAGE_TEXT_ALIGN_CENTER", "center", true);
+define("IMAGE_TEXT_ALIGN_CENTER", "center");
 
 /**
  * Defines vertical alignment to the to the top of the text box. (This is standard.)
  */
-define("IMAGE_TEXT_ALIGN_TOP", "top", true);
+define("IMAGE_TEXT_ALIGN_TOP", "top");
 
 /**
  * Defines vertical alignment to the to the middle of the text box.
  */
-define("IMAGE_TEXT_ALIGN_MIDDLE", "middle", true);
+define("IMAGE_TEXT_ALIGN_MIDDLE", "middle");
 
 /**
  * Defines vertical alignment to the to the bottom of the text box.
  */
-define("IMAGE_TEXT_ALIGN_BOTTOM", "bottom", true);
+define("IMAGE_TEXT_ALIGN_BOTTOM", "bottom");
 
 /**
  * TODO: This constant is useless until now, since justified alignment does not work yet
  */
-define("IMAGE_TEXT_ALIGN_JUSTIFY", "justify", true);
+define("IMAGE_TEXT_ALIGN_JUSTIFY", "justify");
 
 /**
  * Image_Text - Advanced text maipulations in images
@@ -569,7 +569,7 @@ class Image_Text {
         $font_file.= $this->options['font_file'];
         $font_file = realpath($font_file);
         if (empty($font_file) || !is_file($font_file) || !is_readable($font_file)) {
-            return PEAR::raiseError('Fontfile not found or not readable.');
+            return PEAR::staticRaiseError('Fontfile not found or not readable.');
         } else {
             $this->_font = $font_file;
         }
index 921fd2d..0573945 100644 (file)
@@ -158,7 +158,7 @@ class Text_CAPTCHA
      *
      * @see PEAR::isError()
      */
-    function &factory($driver)
+    static function factory($driver)
     {
         if ($driver == '') {
             return PEAR::raiseError('No CAPTCHA type specified ... aborting. You must call ::factory() with one parameter, the CAPTCHA type.', true);
index cab5be7..3b3c94e 100644 (file)
@@ -215,7 +215,7 @@ class Text_CAPTCHA_Driver_Image extends Text_CAPTCHA
                 $options
             );
             if (PEAR::isError($e = $this->_imt->init())) {
-                $this->_error = PEAR::raiseError(
+                $this->_error = PEAR::staticRaiseError(
                     sprintf('Error initializing Image_Text (%s)', $e->getMessage()));
                 return $this->_error;
             } else {
@@ -267,7 +267,7 @@ class Text_CAPTCHA_Driver_Image extends Text_CAPTCHA
     {
         $retval = $this->_createCAPTCHA();
         if (PEAR::isError($retval)) {
-            return PEAR::raiseError($retval->getMessage());
+            return PEAR::staticRaiseError($retval->getMessage());
         }
         
         if ($this->_output == 'gif' && !function_exists('imagegif')) {
@@ -303,7 +303,7 @@ class Text_CAPTCHA_Driver_Image extends Text_CAPTCHA
     {
         $retval = $this->_createCAPTCHA();
         if (PEAR::isError($retval)) {
-            return PEAR::raiseError($retval->getMessage());
+            return PEAR::staticRaiseError($retval->getMessage());
         }
 
         if (is_resource($this->_im)) {