Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 130068 | Differences between
and this patch

Collapse All | Expand All

(-)maia-1.0.1/php/admin/configtest.php (-39 / +132 lines)
Lines 98-103 Link Here
98
    define('OK', "ok");
98
    define('OK', "ok");
99
    define('WARN', "warn");
99
    define('WARN', "warn");
100
    define('ERROR', "error");
100
    define('ERROR', "error");
101
    define('UNK_VER', "unk");
101
    define('UPDATE', "update");
102
    define('UPDATE', "update");
102
103
103
    function print_row($left, $right, $err = OK) {
104
    function print_row($left, $right, $err = OK) {
Lines 111-116 Link Here
111
            case UPDATE:
112
            case UPDATE:
112
                $color = "#DDDD00";
113
                $color = "#DDDD00";
113
                break;
114
                break;
115
            case UNK_VER:
116
                $status = "<b>UNKNOW VERSION</b>";
117
                $color = "#9999FF";
118
		break;
114
            case ERROR:
119
            case ERROR:
115
                $color = "#FE899B";
120
                $color = "#FE899B";
116
                $status = "<b>FAILED</b>";
121
                $status = "<b>FAILED</b>";
Lines 132-137 Link Here
132
137
133
    $status = OK;
138
    $status = OK;
134
139
140
    function check_pear_module($my_path, $my_function = '') {
141
        $ret = @include_once $my_path;
142
        // Test the user given function
143
        if ($res && isset($my_function)) {
144
            $func_ret = call_user_func($my_function);
145
            if ($func_ret) {
146
                $ret = false;
147
                $msg = $func_ret;
148
            }
149
	}
150
	return $ret;
151
    }
152
135
    //smarty compile dirs file permissions.
153
    //smarty compile dirs file permissions.
136
    $smarty_base = "../themes"; // this assumes configtest.php is located in webroot/admin/
154
    $smarty_base = "../themes"; // this assumes configtest.php is located in webroot/admin/
137
    $result = "";
155
    $result = "";
Lines 269-278 Link Here
269
    // PEAR::Mail_Mime
287
    // PEAR::Mail_Mime
270
    if ($have_pear) {
288
    if ($have_pear) {
271
      if (!in_array("mail_mime", $pear_list)) {
289
      if (!in_array("mail_mime", $pear_list)) {
272
        $result = "Not installed.  This PHP extension is required to decode " .
290
        $installed = check_pear_module('Mail/mime.php');
273
                  "MIME-structured e-mail.  Use <b>pear install Mail_Mime</b> to " .
291
	if (! $installed) {
274
                  "install this.";
292
          $result = "Not installed.  This PHP extension is required to decode " .
275
        $status = ERROR;
293
                    "MIME-structured e-mail.  Use <b>pear install Mail_Mime</b> to " .
294
                    "install this.";
295
          $status = ERROR;
296
        } else {
297
	  $result = "Installed, but cannot determine version. Please check your " .
298
	            "system package manager. Versions of Mail_Mime below 1.3.0  " .
299
		    "are known to be buggy.";
300
          $status = UNK_VER;
301
	}
276
      } else {
302
      } else {
277
        $info = $pear_reg->packageInfo("Mail_Mime");
303
        $info = $pear_reg->packageInfo("Mail_Mime");
278
        $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
304
        $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
Lines 287-292 Link Here
287
        }
313
        }
288
      }
314
      }
289
    } else {
315
    } else {
316
    	
290
        $result = "Requires PEAR";
317
        $result = "Requires PEAR";
291
        $status = WARN;
318
        $status = WARN;
292
    }
319
    }
Lines 302-310 Link Here
302
    // PEAR::DB
329
    // PEAR::DB
303
    if ($have_pear) {
330
    if ($have_pear) {
304
        if (!in_array("db", $pear_list)) {
331
        if (!in_array("db", $pear_list)) {
332
	  $installed = check_pear_module('DB.php');
333
	  if (! $installed) {
305
            $result = "Not installed.  This PHP extension is required in order to provide " .
334
            $result = "Not installed.  This PHP extension is required in order to provide " .
306
                      "database abstraction.  Use <b>pear install DB</b> to install this.";
335
                      "database abstraction.  Use <b>pear install DB</b> to install this.";
307
            $status = ERROR;
336
            $status = ERROR;
337
	 } else {
338
	   $result = "Installed, but cannot determine version. Please check your " .
339
	             "system package manager.";
340
	   include_once ("DB.php");
341
           $test_dbh = DB::connect($maia_sql_dsn);
342
	   if (DB::isError($test_dbh)) {
343
	       $result .= "Could not connect to database.  Check the \$maia_sql_dsn setting in config.php.";
344
	       $status = ERROR;
345
	   } else {
346
	       $result .= "Database connexion test OK.";
347
	       $status = UNK_VER;
348
	   }
349
	 }
308
        } else {
350
        } else {
309
          $db_info = $pear_reg->packageInfo("DB");
351
          $db_info = $pear_reg->packageInfo("DB");
310
          $pathArray = explode( PATH_SEPARATOR, get_include_path() );
352
          $pathArray = explode( PATH_SEPARATOR, get_include_path() );
Lines 336-345 Link Here
336
    // PEAR::DB_Pager
378
    // PEAR::DB_Pager
337
    if ($have_pear) {
379
    if ($have_pear) {
338
        if (!in_array("db_pager", $pear_list)) {
380
        if (!in_array("db_pager", $pear_list)) {
339
            $result = "Not installed.  This PHP extension is required in order to paginate " .
381
            $installed = check_pear_module('Pager/Pager.php');
340
                      "the list of mail items in the quarantines and the ham cache.  Use " .
382
            if (! $installed) {
341
                      "<b>pear install DB_Pager</b> to install this.";
383
                $result = "Not installed.  This PHP extension is required in order to paginate " .
342
            $status = ERROR;
384
                          "the list of mail items in the quarantines and the ham cache.  Use " .
385
                          "<b>pear install DB_Pager</b> to install this.";
386
                $status = ERROR;
387
            } else {
388
                $result = "Installed, but cannot determine version. Please check your " .
389
                          "system package manager.";
390
                $status = UNK_VER;
391
            }
343
        } else {
392
        } else {
344
            $pager_info = $pear_reg->packageInfo("DB_Pager");
393
            $pager_info = $pear_reg->packageInfo("DB_Pager");
345
    	    $result = is_array($pager_info["version"])?$pager_info["version"]["release"]:$pager_info["version"];
394
    	    $result = is_array($pager_info["version"])?$pager_info["version"]["release"]:$pager_info["version"];
Lines 352-362 Link Here
352
    print_row("PEAR::DB_Pager", $result, $status);
401
    print_row("PEAR::DB_Pager", $result, $status);
353
402
354
403
355
	  // PEAR::Net_Socket
404
    // PEAR::Net_Socket
356
    if ($have_pear) {
405
    if ($have_pear) {
357
        if (!in_array("net_socket", $pear_list)) {
406
        if (!in_array("net_socket", $pear_list)) {
358
            $result = "Not installed.  This PHP extension is required for Net_SMTP to send mail when rescuing email";
407
	    $installed = check_pear_module('Net/Socket.php');
359
            $status = ERROR;
408
	    if (! $installed) {
409
                $result = "Not installed.  This PHP extension is required for Net_SMTP to send mail when rescuing email";
410
                $status = ERROR;
411
            } else {
412
                $result = "Installed, but cannot determine version. Please check your " .
413
                          "system package manager.";
414
                $status = UNK_VER;
415
            }
360
        } else {
416
        } else {
361
    	    $info = $pear_reg->packageInfo("Net_Socket");
417
    	    $info = $pear_reg->packageInfo("Net_Socket");
362
    	    $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
418
    	    $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
Lines 371-404 Link Here
371
427
372
    // PEAR::Net_SMTP
428
    // PEAR::Net_SMTP
373
    if ($have_pear) {
429
    if ($have_pear) {
374
      if (!in_array("net_smtp", $pear_list)) {
430
        if (!in_array("net_smtp", $pear_list)) {
375
        $result = "Not installed.  This PHP extension is required to send mail when rescuing email";
431
            $installed = check_pear_module('Net/SMTP.php');
376
        $status = ERROR;
432
            if (! $installed) {
377
      } else {
433
                $result = "Not installed.  This PHP extension is required to send mail when rescuing email";
378
        $info = $pear_reg->packageInfo("Net_SMTP");
434
                $status = ERROR;
379
        $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
435
            } else {
380
        if (version_compare($result,"1.1.0") < 0) {
436
                $result = "Installed, but cannot determine version. Please check your " .
381
          $version = $result;
437
                          "system package manager. Need at least version 1.2.5";
382
          $result = "Version $version installed.  Need at least 1.1.0";
438
                $status = UNK_VER;
383
          $status = ERROR;
439
            }
384
        } else {
440
        } else {
385
          $status = OK;
441
            $info = $pear_reg->packageInfo("Net_SMTP");
442
            $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
443
            if (version_compare($result,"1.2.5") < 0) {
444
                $version = $result;
445
                $result = "Version $version installed.  Need at least 1.2.5";
446
                $status = ERROR;
447
            } else {
448
               $status = OK;
449
            }
386
        }
450
        }
387
      }
388
    } else {
451
    } else {
389
      $result ="Requires PEAR";
452
        $result ="Requires PEAR";
390
      $status = WARN;
453
        $status = WARN;
391
    }
454
    }
392
    print_row("PEAR::Net_SMTP", $result, $status);
455
    print_row("PEAR::Net_SMTP", $result, $status);
393
456
394
    // PEAR::Auth_SASL
457
    // PEAR::Auth_SASL
395
    if ($have_pear) {
458
    if ($have_pear) {
396
        if (!in_array("auth_sasl", $pear_list)) {
459
        if (!in_array("auth_sasl", $pear_list)) {
397
            $result = "Not installed.  Optional package. If it is available, " .
460
            $installed = check_pear_module('Auth/SASL.php');
398
                      "the Net_SMTP package will be able to support the DIGEST-MD5 " .
461
            if (! $installed) {
399
                      "and CRAM-MD5 SMTP authentication methods. Otherwise, only " .
462
                $result = "Not installed.  This module is required by PEAR::Net_SMTP in " .
400
                      "the LOGIN and PLAIN methods will be available.";
463
                          "order to support the DIGEST-MD5 and CRAM-MD5 SMTP authentication methods.";
401
            $status = WARN;
464
                $status = ERROR;
465
            } else {
466
                $result = "Installed, but cannot determine version. Please check your " .
467
                          "system package manager.";
468
                $status = UNK_VER;
469
            }
402
        } else {
470
        } else {
403
            $info = $pear_reg->packageInfo("Auth_SASL");
471
            $info = $pear_reg->packageInfo("Auth_SASL");
404
            $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
472
            $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
Lines 413-425 Link Here
413
    // PEAR::Net_IMAP
481
    // PEAR::Net_IMAP
414
    if ($have_pear) {
482
    if ($have_pear) {
415
        if (!in_array("net_imap", $pear_list)) {
483
        if (!in_array("net_imap", $pear_list)) {
416
            $result = "Not installed.  This PHP extension is required to authenticate maia against IMAP.";
484
            $installed = check_pear_module('Net/IMAP.php');
417
            $status = WARN;
485
            if (! $installed) {
486
                $result = "Not installed.  This PHP extension is required to authenticate maia against IMAP.";
487
                $status = WARN;
488
            } else {
489
                $result = "Installed, but cannot determine version. Please check your " .
490
                          "system package manager. A bug exists in Net_IMAP 1.0.3 when run under PHP 5, " .
491
                          " see <a href=\"https://secure.renaissoft.com/maia/ticket/266\">https://secure." .
492
                          "renaissoft.com/maia/ticket/266</a> for more details.";;
493
                $status = UNK_VER;
494
            }
418
        } else {
495
        } else {
419
            $info = $pear_reg->packageInfo("Net_IMAP");
496
            $info = $pear_reg->packageInfo("Net_IMAP");
420
            $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
497
            $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
421
          if ($result == "1.0.3" && $php_version >= "5.0.0") {
498
          if ($result == "1.0.3" && $php_version >= "5.0.0") {
422
             $result = "A bug exists in Net_IMAP 1.0.3 when run under PHP 5, see <a href=\"https://secure.renaissoft.com/maia/ticket/266\">https://secure.renaissoft.com/maia/ticket/266</a> for more details.";
499
             $result = "A bug exists in Net_IMAP 1.0.3 when run under PHP 5, see <a href=\"" .
500
                       "https://secure.renaissoft.com/maia/ticket/266\">https://secure." .
501
                       "renaissoft.com/maia/ticket/266</a> for more details.";
423
             $status = WARN;      
502
             $status = WARN;      
424
          } else {
503
          } else {
425
            $status = OK;
504
            $status = OK;
Lines 434-441 Link Here
434
    // PEAR::Net_POP3
513
    // PEAR::Net_POP3
435
    if ($have_pear) {
514
    if ($have_pear) {
436
        if (!in_array("net_pop3", $pear_list)) {
515
        if (!in_array("net_pop3", $pear_list)) {
437
            $result = "Not installed.  This PHP extension is required to authenticate maia against POP3.";
516
            $installed = check_pear_module('Net/POP3.php');
438
            $status = WARN;
517
            if (! $installed) {
518
                $result = "Not installed.  This PHP extension is required to authenticate maia against POP3.";
519
                $status = WARN;
520
            } else {
521
                $result = "Installed, but cannot determine version. Please check your " .
522
                          "system package manager.";
523
                $status = UNK_VER;
524
            }
439
        } else {
525
        } else {
440
            $info = $pear_reg->packageInfo("Net_POP3");
526
            $info = $pear_reg->packageInfo("Net_POP3");
441
            $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
527
            $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];
Lines 450-459 Link Here
450
    // PEAR::Log
536
    // PEAR::Log
451
    if ($have_pear) {
537
    if ($have_pear) {
452
        if (!in_array("log", $pear_list)) {
538
        if (!in_array("log", $pear_list)) {
453
            $result = "Not installed, but only required if you want to be able to log user " .
539
            $installed = check_pear_module('Log.php');
454
                      "and administrator activity.  Use <b>pear install Log</b> to install " .
540
            if (! $installed) {
455
                      "this PHP extension.";
541
                $result = "Not installed, but only required if you want to be able to log user " .
456
            $status = ERROR;
542
                          "and administrator activity.  Use <b>pear install Log</b> to install " .
543
                          "this PHP extension.";
544
                $status = ERROR;
545
            } else {
546
                $result = "Installed, but cannot determine version. Please check your " .
547
                          "system package manager.";
548
                $status = UNK_VER;
549
            }
457
        } else {
550
        } else {
458
    	    $log_info = $pear_reg->packageInfo("Log");
551
    	    $log_info = $pear_reg->packageInfo("Log");
459
    	    $result = is_array($log_info["version"])?$log_info["version"]["release"]:$log_info["version"];
552
    	    $result = is_array($log_info["version"])?$log_info["version"]["release"]:$log_info["version"];

Return to bug 130068