root/modules/branches/2.10/dashboard/class.procinfo.php

Revision 13091, 1.1 kB (checked in by p_lindheimer, 5 months ago)

adds FREEPBX_IS_AUTH checking to most module files re #5478

Line 
1 <?php
2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
3
4 class procinfo {
5   var $distro;
6  
7   function procinfo($distro = false) {
8     $this->distro = $distro;
9   }
10  
11   function check_port($port, $server = "localhost") {
12     $timeout = 5;
13     if ($sock = @fsockopen($server, $port, $errno, $errstr, $timeout)) {
14       fclose($sock);
15       return true;
16     }
17     return false;
18   }
19  
20   /* FOP has been removed, currenlty unsupported optional module
21   function check_fop_server() {
22     global $amp_conf;
23     $fop_settings = parse_ini_file($amp_conf['FOPWEBROOT'].'/op_server.cfg');
24     if (is_array($fop_settings)) {
25       $listen_port = isset($fop_settings['listen_port']) && trim($fop_settings['listen_port']) != ''?$fop_settings['listen_port']:4445;
26     } else {
27       $listen_port = 4445;
28     }
29
30     return $this->check_port($listen_port);
31   }
32    */
33  
34   function check_mysql($hoststr) {
35     $host = 'localhost';
36     $port = '3306';
37     if (preg_match('/^([^:]+)(:(\d+))?$/',$hoststr,$matches)) {
38       // matches[1] = host, [3] = port
39       $host = $matches[1];
40       if (!empty($matches[3])) {
41         $port = $matches[3];
42       }
43     }
44     return $this->check_port($port, $host);
45   }
46 }
47
48 ?>
Note: See TracBrowser for help on using the browser.