diff --git a/resources/classes/config.php.txt b/resources/classes/config.php.txt new file mode 100644 index 0000000000..b7027186bb --- /dev/null +++ b/resources/classes/config.php.txt @@ -0,0 +1,88 @@ + $value) { + unset($this->$key); + } + } + + /** + * Determine whether the config.php exists + * @var string $db_type - type of database + * @var string $db_name - name of the database + * @var string $db_username - username to access the database + * @var string $db_password - password to access the database + * @var string $db_host - hostname of the database server + * @var string $db_path - path of the database file + * @var string $db_port - network port to connect to the database + */ + public function get() { + if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { + include($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"); + } elseif (file_exists("/etc/fusionpbx/config.php")) { + include("/etc/fusionpbx/config.php"); + } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { + include("/usr/local/etc/fusionpbx/config.php"); + } + $this->db_type = $db_type; + $this->db_name = $db_name; + $this->db_username = $db_username; + $this->db_password = $db_password; + $this->db_host = $db_host; + $this->db_path = $db_path; + $this->db_port = $db_port; + } + + /** + * Determine whether the config.php exists + */ + public function exists() { + if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { + return true; + } elseif (file_exists("/etc/fusionpbx/config.php")) { + return true; + } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { + return true; + } + else { + return false; + } + } +} +/* +$config = new config; +$config = $config->get; +$config_exists = $config->exists(); +*/ + +?> \ No newline at end of file