functions.inc.php minor cleanup
This commit is contained in:
parent
c389ab0780
commit
51829c6f98
|
@ -15,10 +15,9 @@ if(preg_match("/functions.inc.php/", $_SERVER['SCRIPT_NAME'])) {
|
|||
DEFINE("VERSION", "version 1.0.0");
|
||||
DEFINE('ROOT_PATH', dirname(__FILE__) . '/');
|
||||
require_once ROOT_PATH . 'conf.php';
|
||||
#require_once ROOT_PATH . 'config.inc.php';
|
||||
|
||||
//
|
||||
// Check of debug is enabled or not
|
||||
// Check if debug is enabled or not
|
||||
//
|
||||
if (DEBUG == 'true') {
|
||||
ini_set('display_errors', 1);
|
||||
|
@ -33,7 +32,7 @@ if (DEBUG == 'true') {
|
|||
//
|
||||
// check_session
|
||||
// Action: Check if a session already exists, if not redirect to login.php
|
||||
// Call: check_session() -or- check_user_session()
|
||||
// Call: check_session()
|
||||
//
|
||||
function check_session($session = "sessid") {
|
||||
session_start();
|
||||
|
@ -48,15 +47,15 @@ function check_session($session = "sessid") {
|
|||
// check_language
|
||||
// Action: checks what language the browser uses
|
||||
// Call: check_language
|
||||
// Currently only English is supported, no need to run through the check now.
|
||||
//
|
||||
function check_language() {
|
||||
// Currently only English is supported, no need to run through the check now.
|
||||
return DEFAULT_LANGUAGE;
|
||||
}
|
||||
|
||||
//
|
||||
// bcrypt
|
||||
// Action: Hashs the password with bcrypt
|
||||
// Action: Hashes the password with bcrypt, make it OpenBSD friendly
|
||||
// Call: bcrypt(string cleartextpassword)
|
||||
//
|
||||
function bcrypt($password) {
|
||||
|
@ -68,7 +67,7 @@ function bcrypt($password) {
|
|||
|
||||
//
|
||||
// pdo_connect
|
||||
// Action: make db connection
|
||||
// Action: make PDO db connection
|
||||
// Call: pdo_connect()
|
||||
//
|
||||
function pdo_connect() {
|
||||
|
@ -84,7 +83,7 @@ function pdo_connect() {
|
|||
|
||||
//
|
||||
// list_domains
|
||||
// Action: List all available domains.
|
||||
// Action: list all available domains for admin
|
||||
// Call: list_domains(string admin (optional))
|
||||
//
|
||||
function list_domains($username = null) {
|
||||
|
@ -114,7 +113,7 @@ function list_domains($username = null) {
|
|||
|
||||
//
|
||||
// list_aliases
|
||||
// Action: List all available aliases for domain.
|
||||
// Action: list all available aliases for domain
|
||||
// Call: list_aliases(string domain, int offset)
|
||||
//
|
||||
function list_aliases($domain, $offset, $limit) {
|
||||
|
@ -134,7 +133,7 @@ function list_aliases($domain, $offset, $limit) {
|
|||
|
||||
//
|
||||
// list_mailboxes
|
||||
// Action: List all available mailboxes for domain.
|
||||
// Action: list all available mailboxes for domain
|
||||
// Call: list_mailboxes(string domaini, int offset)
|
||||
//
|
||||
function list_mailboxes($domain, $offset, $limit) {
|
||||
|
@ -150,11 +149,11 @@ function list_mailboxes($domain, $offset, $limit) {
|
|||
|
||||
//
|
||||
// list_admins
|
||||
// Action: Lists all the admins
|
||||
// Action: lists all the admins
|
||||
// Call: list_admins()
|
||||
//
|
||||
function list_admins() {
|
||||
$dbh = new PDO(DB_TYPE . ':host='. DB_HOST . ';dbname='. DB_NAME , DB_USER, DB_PASS);
|
||||
$dbh = pdo_connect();
|
||||
$sth = $dbh->prepare('SELECT * FROM admin ORDER BY username');
|
||||
$sth->execute();
|
||||
$list = $sth->fetchAll();
|
||||
|
@ -169,7 +168,7 @@ function list_admins() {
|
|||
}
|
||||
|
||||
// logging
|
||||
// Action: Logs actions from admin
|
||||
// Action: logs actions from admin
|
||||
// Call: logging(string username, string domain, string action, string data)
|
||||
//
|
||||
function logging($username, $domain, $action, $data) {
|
||||
|
|
Loading…
Reference in New Issue