commit - c389ab0780d1b14ce1a769615db166fdf69d84dd
commit + 51829c6f98d5c344c400426260c494aa889af758
blob - 3cb8829f4b5dd6330856ba7789651d462eebc043
blob + 19b6e174d591f51cd657114ac8fcb2f4a2af7f7a
--- functions.inc.php
+++ functions.inc.php
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);
//
// 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();
// 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) {
//
// pdo_connect
-// Action: make db connection
+// Action: make PDO db connection
// Call: pdo_connect()
//
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) {
//
// 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) {
//
// 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) {
//
// 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();
}
// 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) {