コード例 #1
0
function IMPORT_MEMBERS()
{
    $me = $_SERVER["SERVER_NAME"];
    $error = array();
    $members = unserialize(base64_decode($_POST["MEMBERS"]));
    writelogs("Analyze " . count($members) . " members for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
    while (list($uid, $array) = each($members)) {
        writelogs("Analyze {$uid} for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
        $user = new user($uid);
        if ($user->UserExists) {
            $user->password = $array["password"];
            if ($user->add_user()) {
                $success[] = "{$me}::IMPORT_MEMBERS:: Success updating {$uid} in LDAP database";
            } else {
                $error[] = "Failed updating {$uid} in LDAP database\n {$user->ldap_error}";
            }
            continue;
        }
        while (list($key, $value) = each($array)) {
            $user->{$key} = $value;
        }
        if ($user->add_user()) {
            $success[] = "{$me}::IMPORT_MEMBERS:: Success adding {$uid} in LDAP database";
        } else {
            $error[] = "Failed adding {$uid} in LDAP database\n {$user->ldap_error}";
        }
    }
    if (count($error) > 0) {
        echo "<ERROR>" . @implode("\n", $error) . "</ERROR>";
    }
    if (count($success) > 0) {
        echo "<SUCCESS>" . @implode("\n", $success) . "</SUCCESS>";
    }
}
コード例 #2
0
ファイル: user.php プロジェクト: kennethmensah/MWC-Final-Gap
function signup_control()
{
    if (filter_input(INPUT_GET, 'user') && filter_input(INPUT_GET, 'pass') && filter_input(INPUT_GET, 'email') && filter_input(INPUT_GET, 'phone')) {
        $obj = new user();
        $username = sanitize_string(filter_input(INPUT_GET, 'user'));
        $password = sanitize_string(filter_input(INPUT_GET, 'pass'));
        $email = sanitize_string(filter_input(INPUT_GET, 'email'));
        $phone = sanitize_string(filter_input(INPUT_GET, 'phone'));
        if ($obj->add_user($username, $password, $email, $phone)) {
            $msg = "Dear, " . $username . "\n";
            $msg .= "Thank You for joining book reviews. \n";
            $msg .= "We are delighted you have become a part of this wonderful learning experience";
            $msg .= "Read Right With BOOK REVIEWS!!!";
            $to = $email;
            $subject = "Welcome";
            $headers = "From: kenneth.mensah@ashesi.edu.gh";
            $_SESSION['phone'] = $phone;
            mail($to, $subject, $msg, $headers);
            echo '{"result":1,"username": "******",
                    "email": "' . $email . '", "phone": "' . $phone . '"}';
        } else {
            echo '{"result":0,"message": "signup unsuccessful"}';
        }
    }
}
コード例 #3
0
ファイル: edit.thumbnail.php プロジェクト: brucewu16899/1.6.x
function PhotoUploaded()
{
    $tmp_file = $_FILES['photo']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        @mkdir($content_dir);
    }
    if (!@is_uploaded_file($tmp_file)) {
        writelogs("PHOTO: error_unable_to_upload_file", __FUNCTION__, __FILE__, __LINE__);
        $GLOBALS["Photo_error"] = '{error_unable_to_upload_file} ' . $tmp_file;
        return;
    }
    $name_file = $_FILES['photo']['name'];
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
        $GLOBALS["Photo_error"] = "{error_unable_to_move_file} : " . $content_dir . "/" . $name_file;
        writelogs("PHOTO: {error_unable_to_move_file} : " . $content_dir . "/" . $name_file, __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $file = $content_dir . "/" . $name_file;
    writelogs("PHOTO: {$file}", __FUNCTION__, __FILE__, __LINE__);
    if (isset($_POST["uid"])) {
        $_GET["uid"] = $_POST["uid"];
        $user = new user($_POST["uid"]);
        $jpegPhoto_datas = file_get_contents($file);
        $user->add_user();
        writelogs("PHOTO: Edit: " . strlen($jpegPhoto_datas) . " bytes", __FUNCTION__, __FILE__, __LINE__);
        if (!$user->SaveUserPhoto($jpegPhoto_datas)) {
            $GLOBALS["Photo_error"] = $user->ldap_error;
            return;
        }
        if (is_file($user->thumbnail_path)) {
            unlink($user->thumbnail_path);
        }
        return null;
    }
    if (isset($_POST["employeeNumber"])) {
        $_GET["employeeNumber"] = $_POST["employeeNumber"];
        $user = new contacts($_SESSION["uid"], $_POST["employeeNumber"]);
        $user->jpegPhoto_datas = file_get_contents($file);
        if ($_SESSION["uid"] != -100) {
            $ldap = new clladp();
            $user2 = new user($_SESSION["uid"]);
            $dn = "cn={$user->sn} {$user->givenName},ou={$user2->uid},ou=People,dc={$user2->ou},dc=NAB,{$ldap->suffix}";
            if ($dn == $user->dn) {
                $user->Save();
            } else {
                $tpl = new templates();
                echo $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
            }
        }
        if (is_file($user->thumbnail_path)) {
            unlink($user->thumbnail_path);
        }
        return null;
    }
}
コード例 #4
0
function joomla_save()
{
    $user = new user($_GET["userid"]);
    $user->JoomlaGroup = $_GET["JoomlaGroup"];
    if ($user->add_user()) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("Joomla: {success}\n");
    }
}
コード例 #5
0
function TASK_USER_EDIT($zmd5)
{
    $meta = new artica_meta(true);
    include_once dirname(__FILE__) . '/ressources/class.user.inc';
    events("Get user informations from {$zmd5}", __FUNCTION__, __FILE__, __LINE__);
    $http = new httpget();
    $datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
    $body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "GET_USER_INFO" => $zmd5));
    if (preg_match("#<RESULTS>(.+?)</RESULTS>#", $body, $re)) {
        $array = unserialize(base64_decode($re[1]));
    }
    if (!is_array($array)) {
        events("Get user informations ERROR not an Array", __FUNCTION__, __FILE__, __LINE__);
        send_email_events("Failed to add user task id \"{$zmd5}\"", "Error detected\nGet user informations ERROR not an Array", "CLOUD");
        return true;
    }
    foreach ($array as $key => $value) {
        $userArray[$key] = $value;
    }
    $user = new user($userArray["uid"]);
    $user->ou = $userArray["ou"];
    events("Get user informations {$userArray["uid"]} done", __FUNCTION__, __FILE__, __LINE__);
    $ldap = new clladp();
    $ldap->AddOrganization($user->ou);
    $user->password = $userArray["userpassword"];
    $user->mail = $userArray["mail"];
    $user->DisplayName = $userArray["displayname"];
    $user->homeDirectory = $userArray["homedirectory"];
    $user->sn = $userArray["sn"];
    $user->group_id = $userArray["gidnumber"];
    $user->FTPDownloadBandwidth = $userArray["ftpdownloadbandwidth"];
    $user->FTPDownloadRatio = $userArray["ftpdownloadratio"];
    $user->FTPQuotaFiles = $userArray["ftpquotafiles"];
    $user->FTPQuotaMBytes = $userArray["ftpquotambytes"];
    $user->FTPUploadRatio = $userArray["ftpuploadratio"];
    $user->postalCode = $userArray["postalcode"];
    $user->postalAddress = $userArray["postaladdress"];
    $user->street = $userArray["street"];
    $user->givenName = $userArray["givenname"];
    $user->mobile = $userArray["mobile"];
    $user->telephoneNumber = $userArray["telephonenumber"];
    $user->zarafaQuotaHard = $userArray["zarafaQuotaHard"];
    $user->zarafaQuotaWarn = $userArray["zarafaQuotaWarn"];
    $user->zarafaQuotaSoft = $userArray["zarafaQuotaSoft"];
    if (trim($userArray["mailboxsecurityparameters"]) == null) {
        $userArray["mailboxsecurityparameters"] = "[mailbox]\nl=1\nr=1\ns=1\nw=1\ni=1\np=1\nc=1\nd=1\na=1";
    }
    if (trim($userArray["mailboxactive"]) == null) {
        $userArray["mailboxactive"] = "TRUE";
    }
    if ($userArray["mailboxactive"] == 1) {
        $userArray["mailboxactive"] = "TRUE";
    } else {
        $userArray["mailboxactive"] = "FALSE";
    }
    $user->MailboxSecurityParameters = $userArray["mailboxsecurityparameters"];
    $user->MailboxActive = $userArray["mailboxactive"];
    $user->MailBoxMaxSize = $userArray["mailboxmaxsize"];
    events("Saving user information...", __FUNCTION__, __FILE__, __LINE__);
    if (!$user->add_user()) {
        events("Failed to add user {$userArray["uid"]}", __FUNCTION__, __FILE__, __LINE__);
        send_email_events("Failed to add {$userArray["uid"]}", "reason {$user->error}", "CLOUD");
        return false;
    } else {
        events("Call to unlock user", __FUNCTION__, __FILE__, __LINE__);
        $http = new httpget();
        send_email_events("Success to add {$userArray["uid"]}", "Adding this user:\n{$userArray["mail"]}\nOrganization:{$userArray["ou"]}\n", "CLOUD");
        $body = $http->send("{$meta->ArticaMetaHostname}/lic.query.server.php", "post", array("DATAS" => $datasToSend, "UNLOCK_USER" => $zmd5));
        return true;
    }
}
コード例 #6
0
function MEMBERS_IMPORT_FILE()
{
    $file = $_GET["ImportMembersFile"];
    $groupid = $_GET["groupid"];
    $gg = new groups($groupid);
    $ou = $gg->ou;
    writelogs("importing {$file}....", __FUNCTION__, __FILE__);
    $datas = file_get_contents($file);
    $datas = explode("\n", $datas);
    $good = 0;
    $bad = 0;
    $count_user = 0;
    if (is_array($datas)) {
        while (list($num, $ligne) = each($datas)) {
            if (trim($ligne) == null) {
                continue;
            }
            $ligne = str_replace('"', '', $ligne);
            $ligne = str_replace("'", "`", $ligne);
            $table = explode(";", $ligne);
            if ($table[2] == null) {
                continue;
            }
            $count_user = $count_user + 1;
            $user = new user();
            $user->uid = $table[2];
            $user->ou = $ou;
            $user->DisplayName = $table[0];
            $user->group_id = $groupid;
            $user->mail = $table[1];
            $user->password = $table[3];
            $user->PostalCode = $table[4];
            $user->postalAddress = $table[5];
            $user->mobile = $table[6];
            $user->telephoneNumber = $table[7];
            if ($user->add_user()) {
                if ($table[8] != null) {
                    $aliases = explode(',', $table[8]);
                    if (is_array($aliases)) {
                        while (list($num1, $mail_ali) = each($aliases)) {
                            if (trim($mail_ali) == null) {
                                continue;
                            }
                            $user->add_alias($mail_ali);
                        }
                    }
                }
                $good = $good + 1;
            } else {
                $bad = $bad + 1;
            }
        }
    }
    $html = "\n\t<strong>{$group_error}</strong>\n\t<table style='width:100%;padding:1px;border:1px solid #CCCCCC'>\n\t<tr>\n\t<th>{success}</th>\n\t<th>{failed}</th>\n\t<th>{members}</th>\n\t</tr>\n\t<tr>\n\t<td align='center'><strong>{$good}</td>\n\t<td align='center'><strong>{$bad}</td>\n\t<td align='center'><strong>{$count_user}</td>\n\t</tr>\n\t<tr>\n\t<td colspan=3><strong>{group} N.{$groupid}</strong></td></tr>\n\t</table>\n\t{$logs}\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body(RoundedLightWhite($html));
}
コード例 #7
0
function MEMBERS_IMPORT_FILE()
{
    $file = $_GET["ImportMembersFile"];
    $groupid = $_GET["groupid"];
    $gg = new groups($groupid);
    $ou = $gg->ou;
    $MainDomain = null;
    if (!isset($GLOBALS["MEM_DOMAINS"][$ou])) {
        FILL_MEM_LOCAL_DOMAINS($ou);
    }
    $MainDomain = $GLOBALS["MEM_DOMAINS"][$ou][0];
    unset($GLOBALS["MEM_DOMAINS"][$ou][0]);
    writelogs("importing {$file}....", __FUNCTION__, __FILE__);
    $datas = file_get_contents($file);
    $datas = explode("\n", $datas);
    $good = 0;
    $bad = 0;
    $count_user = 0;
    if (is_array($datas)) {
        while (list($num, $ligne) = each($datas)) {
            if (trim($ligne) == null) {
                continue;
            }
            $ligne = str_replace('"', '', $ligne);
            $ligne = str_replace("\r\n", "", $ligne);
            $ligne = str_replace("\r", "", $ligne);
            $ligne = str_replace("\n", "", $ligne);
            $ligne = str_replace("'", "`", $ligne);
            $table = explode(";", $ligne);
            if ($table[2] == null) {
                continue;
            }
            $count_user = $count_user + 1;
            $user = new user();
            $user->SIMPLE_SCHEMA = true;
            $user->uid = $table[2];
            $user->ou = $ou;
            $user->DisplayName = $table[0];
            if (strpos(trim($user->DisplayName), " ") > 0) {
                $splituser = explode(" ", $user->DisplayName);
                $user->givenName = $splituser[0];
                unset($splituser[0]);
                $user->sn = @implode(" ", $splituser);
            }
            $user->group_id = $groupid;
            $user->mail = $table[1];
            if ($MainDomain != null) {
                if (!preg_match("#(.*?)@(.+)#", $user->mail)) {
                    $user->mail = "{$user->mail}@{$MainDomain}";
                }
            }
            $user->password = $table[3];
            $user->PostalCode = $table[4];
            $user->postalAddress = $table[5];
            $user->mobile = $table[6];
            $user->telephoneNumber = $table[7];
            if ($user->add_user()) {
                if ($table[8] != null) {
                    $aliases = explode(',', $table[8]);
                    if (is_array($aliases)) {
                        while (list($num1, $mail_ali) = each($aliases)) {
                            if (trim($mail_ali) == null) {
                                continue;
                            }
                            $user->add_alias($mail_ali);
                        }
                    }
                }
                if (count($GLOBALS["MEM_DOMAINS"][$ou]) > 0) {
                    reset($GLOBALS["MEM_DOMAINS"][$ou]);
                    while (list($num1, $domainz) = each($GLOBALS["MEM_DOMAINS"][$ou])) {
                        $user->add_alias("{$user->uid}@{$domainz}");
                    }
                }
                $good = $good + 1;
            } else {
                $bad = $bad + 1;
            }
        }
    }
    $html = "\n\t<strong>{$group_error}</strong>\n\t<table style='width:100%;padding:1px;border:1px solid #CCCCCC'>\n\t<tr>\n\t<th>{success}</th>\n\t<th>{failed}</th>\n\t<th>{members}</th>\n\t</tr>\n\t<tr>\n\t<td align='center'><strong>{$good}</td>\n\t<td align='center'><strong>{$bad}</td>\n\t<td align='center'><strong>{$count_user}</td>\n\t</tr>\n\t<tr>\n\t<td colspan=3><strong>{group} N.{$groupid}</strong></td></tr>\n\t</table>\n\t{$logs}\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body(RoundedLightWhite($html));
}
コード例 #8
0
function import_single_file($filepath, $ID, $ou, $localdomain)
{
    writelogs("{$ID}:: importing {$filepath} for {$ou}", __FUNCTION__, __FILE__, __LINE__);
    if ($ou == null) {
        writelogs("{$ID}:: OU IS NULL !!! ", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $GLOBALS["OU"] = $ou;
    $f = explode("\n", @file_get_contents($filepath));
    $ldap = new clladp();
    $count = 0;
    while (list($num, $line) = each($f)) {
        if ($line == null) {
            continue;
        }
        $tbl = explode(";", $line);
        $account = $tbl[0];
        $password = $tbl[1];
        $imap_server = $tbl[2];
        $new_uid = null;
        $uid = null;
        $usessl = 0;
        $zmd5 = md5("{$account}{$imap_server}");
        if (preg_match("#(.+?)@(.+?)\$#", trim($account), $re)) {
            $new_uid = $re[1];
        } else {
            $new_uid = $account;
        }
        writelogs("{$ID}:: local user={$new_uid}@{$localdomain}", __FUNCTION__, __FILE__, __LINE__);
        $uid = $ldap->uid_from_email("{$new_uid}@{$localdomain}");
        if ($uid == null) {
            if (preg_match("#(.+?)@(.+?)\$#", trim($new_uid), $re)) {
                $new_uid = $re[1];
            }
            writelogs("{$ID}:: Add uid=\"{$new_uid}\" ou={$GLOBALS["OU"]} mail={$new_uid}@{$localdomain}", __FUNCTION__, __FILE__, __LINE__);
            $user_uid = new user();
            $user_uid->uid = $new_uid;
            $user_uid->ou = $GLOBALS["OU"];
            $user_uid->password = $password;
            $user_uid->mail = "{$new_uid}@{$localdomain}";
            $user_uid->domainname = $localdomain;
            if (!$user_uid->add_user()) {
                writelogs("{$ID}:: failed to add {$user_uid->uid} in LDAP database", __FUNCTION__, __FILE__, __LINE__);
                continue;
            } else {
                $new_uid = $user_uid->uid;
            }
        } else {
            $new_uid = $uid;
        }
        $count++;
        writelogs("{$ID}:: local uid:{$uid}", __FUNCTION__, __FILE__, __LINE__);
        if (preg_match("#ssl:(.+?)\$#", $imap_server, $re)) {
            $usessl = 1;
            $imap_server = $re[1];
        }
        $sql = "INSERT INTO mbx_migr_users (`zmd5`,`mbx_migr_id`,`ou`, `imap_server`,`usessl`,`username`,`password`,`uid`)\n\t\tVALUES('{$zmd5}','{$ID}','{$GLOBALS["OU"]}','{$imap_server}','{$usessl}','{$account}','{$password}','{$new_uid}')";
        writelogs("{$ID}:: \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__);
        $q = new mysql();
        $q->QUERY_SQL($sql, "artica_backup");
        if (!$q->ok) {
            writelogs("{$ID}:: {$q->mysql_error} \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__);
        }
    }
    $sql = "UPDATE mbx_migr SET imported=1,members_count={$count} WHERE ID={$ID}";
    $q = new mysql();
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        writelogs("{$ID}:: {$q->mysql_error} \"{$sql}\"", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $users = new usersMenus();
    if (!$users->offlineimap_installed) {
        shell_exec("/usr/share/artica-postfix/bin/artica-make APP_OFFLINEIMAP");
    }
    sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN2() . " " . __FILE__ . " --accounts");
}
コード例 #9
0
<?php

if (isset($_POST['karyawan']) && isset($_POST['username']) && isset($_POST['password']) && $_POST['karyawan'] != "" && $_POST['username'] != "" && $_POST['password'] != "") {
    include './app/class.user.php';
    $data = new user();
    if ($insert = $data->add_user($_POST['karyawan'], $_POST['username'], $_POST['password'])) {
        echo "<script> alert('Data tersimpan'); window.location='./?no_spa=" . e_url('./app/user.php') . "'; </script>";
    } else {
        echo "<script> alert('Gagal menyimpan, cek kembali..!');</script>";
    }
}
コード例 #10
0
ファイル: admin.php プロジェクト: Critter/lwsts
        $edit = $staff->edit_departments($_POST['adddepartment'], 'add');
    } elseif (isset($_POST['delproduct'])) {
        $edit = $staff->edit_products($_POST['delproduct'], 'del');
    } elseif (isset($_POST['addproduct'])) {
        $edit = $staff->edit_products($_POST['addproduct'], 'add');
    }
    if ($edit) {
        $successmsg = "Operation successfull";
    } else {
        $errormsg = $staff->get_error();
    }
}
if (isset($_POST['name'])) {
    $user = new user();
    $user->db_open();
    $adduser = $user->add_user($_POST['name'], $_POST['regemail'], $_POST['confirmemail'], $_POST['regpassword'], $_POST['confirmpassword'], 2);
    if ($adduser) {
        $successmsg = "New staff user crated.";
    } else {
        $errormsg = $user->get_error;
    }
}
$departments = $ticket->get_departments();
$products = $ticket->get_products();
?>

<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Ticket System - Profile</title>
コード例 #11
0
ファイル: add_user.php プロジェクト: minhnh94/testphp
    }
    if ($_POST['trangthai'] == '') {
        $error = 'khong duoc de trong';
    } else {
        $trangThai = $_POST['trangthai'];
    }
    if ($tenDangNhap && $matKhau && $email && $hoTen && $maQuyen && $ngayDangKy && $trangThai) {
        $user1 = new user();
        $user1->set_tk($tenDangNhap);
        $user1->set_mk($matKhau);
        $user1->setName($hoTen);
        $user1->setEmail($email);
        $user1->set_qtc($maQuyen);
        $user1->setNgaydangky($ngayDangKy);
        $user1->setTrangthai($trangThai);
        if ($user1->add_user() == "user exist") {
            $error = 'tai khoan da ton tai';
        } else {
            header('location:admin-board.php');
        }
    }
}
?>
<form method="post">
<span style="color:red; text-align:center;"><h3><?php 
if (isset($error)) {
    echo $error;
}
?>
</h3></span>
<table align="center" width="400" border="1">
コード例 #12
0
function SaveAllowedSMTP()
{
    $user = new user($_GET["uid"]);
    $user->AllowedSMTPTroughtInternet = $_GET["AllowedSMTPTroughtInternet"];
    if ($user->add_user()) {
        $tpl = new templates();
        echo html_entity_decode($tpl->_ENGINE_parse_body("\n{AllowedSMTPTroughtInternet}\n{success}:\n" . $_GET["uid"]));
    }
}
コード例 #13
0
ファイル: user.picture.php プロジェクト: brucewu16899/artica
function PhotoUploaded()
{
    $tmp_file = $_FILES['photo']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        @mkdir($content_dir, 0755, true);
    }
    if (!is_dir($content_dir)) {
        $_GET["Photo_error"] = '{error_unable_to_create_dir} ' . $content_dir;
        iframe();
        exit;
    }
    if (!@is_uploaded_file($tmp_file)) {
        $_GET["Photo_error"] = '{error_unable_to_upload_file} <code style=font-size:11px>' . $tmp_file . "</code>";
        exit;
    }
    $name_file = $_FILES['photo']['name'];
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
        $_GET["Photo_error"] = "{error_unable_to_move_file} : <code style=font-size:11px>{$tmp_file}</code> {to} <code style=font-size:11px>" . str_replace(dirname(__FILE__), "", $content_dir) . "/" . $name_file . "</code>";
        iframe();
        exit;
    }
    $file = $content_dir . "/" . $name_file;
    if (isset($_POST["uid"])) {
        $_GET["uid"] = $_POST["uid"];
        $user = new user($_POST["uid"]);
        $user->jpegPhoto_datas = file_get_contents($file);
        $user->add_user();
        if (is_file($user->thumbnail_path)) {
            unlink($user->thumbnail_path);
        }
        iframe();
        exit;
        return null;
    }
    if (isset($_POST["employeeNumber"])) {
        $_GET["employeeNumber"] = $_POST["employeeNumber"];
        $user = new contacts($_SESSION["uid"], $_POST["employeeNumber"]);
        $user->jpegPhoto_datas = file_get_contents($file);
        if ($_SESSION["uid"] != -100) {
            $ldap = new clladp();
            $user2 = new user($_SESSION["uid"]);
            $dn = "cn={$user->sn} {$user->givenName},ou={$user2->uid},ou=People,dc={$user2->ou},dc=NAB,{$ldap->suffix}";
            if ($dn == $user->dn) {
                $user->Save();
            } else {
                $tpl = new templates();
                echo $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
            }
        }
        if (is_file($user->thumbnail_path)) {
            unlink($user->thumbnail_path);
        }
        iframe();
        exit;
    }
    iframe();
    exit;
}
コード例 #14
0
function SavevacationInfo()
{
    $info = $_GET["vacationInfo"];
    $users = new user($_SESSION["uid"]);
    $users->vacationInfo = $info;
    if (!$users->add_user()) {
        echo $users->ldap_error;
    }
}
コード例 #15
0
ファイル: exec.whiteblack.php プロジェクト: articatech/artica
function CreateThisUser($email)
{
    if (!preg_match("#(.+?)@(.+)#", $email, $re)) {
        return null;
    }
    $domain = $re[2];
    $uid = $re[1];
    $ldap = new clladp();
    $ou = $ldap->ou_by_smtp_domain($domain);
    if ($ou == null) {
        write_syslog("CreateThisUser():: Unable to detect organization by domain \"{$domain}\"", __FILE__);
        return null;
    }
    $ct = new user($uid);
    $ct->ou = $ou;
    $ct->mail = $email;
    $ct->uid = $uid;
    if (!$ct->add_user()) {
        write_syslog("CreateThisUser():: Unable to Create user {$uid} \"{$email}\"", __FILE__);
        return null;
    }
    $uid2 = $ldap->uid_from_email($email);
    write_syslog("CreateThisUser():: new user \"{$uid2}\"", __FILE__);
    return $uid2;
}
コード例 #16
0
function AddNewInternetDomain()
{
    $usr = new usersMenus();
    $tpl = new templates();
    if ($usr->AllowChangeDomains == false) {
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        exit;
    }
    $tpl = new templates();
    $ou = $_GET["AddNewInternetDomain"];
    $domain = trim(strtolower($_GET["AddNewInternetDomainDomainName"]));
    $ldap = new clladp();
    $sock = new sockets();
    $InternetDomainsAsOnlySubdomains = $sock->GET_INFO("InternetDomainsAsOnlySubdomains");
    if ($InternetDomainsAsOnlySubdomains == 1) {
        if (!$usr->OverWriteRestrictedDomains) {
            $domaintbl = explode(".", $domain);
            $subdomain = $domaintbl[0];
            unset($domaintbl[0]);
            $domainsuffix = @implode(".", $domaintbl);
            $sql = "SELECT domain FROM officials_domains WHERE domain='{$domainsuffix}'";
            $q = new mysql();
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
            if (!$q->ok) {
                echo $q->mysql_error;
                return;
            }
            if ($ligne["domain"] == null) {
                echo $tpl->_ENGINE_parse_body("{please_choose_an_official_domain}");
                return;
            }
        }
    }
    $hashdoms = $ldap->hash_get_all_domains();
    writelogs("hashdoms[{$domain}]={$hashdoms[$domain]}", __FUNCTION__, __FILE__);
    if ($hashdoms[$domain] != null) {
        echo $tpl->_ENGINE_parse_body('{error_domain_exists}');
        exit;
    }
    if (!$ldap->AddDomainEntity($ou, $domain)) {
        echo $ldap->ldap_last_error;
        return;
    }
    $sock = new sockets();
    if ($usr->cyrus_imapd_installed) {
        $sock->getFrameWork("cmd.php?cyrus-check-cyr-accounts=yes");
    }
    $sock->getFrameWork("cmd.php?postfix-transport-maps=yes");
    if ($usr->AMAVIS_INSTALLED) {
        $sock->getFrameWork("cmd.php?amavis-restart=yes");
    }
    include_once dirname(__FILE__) . "/ressources/class.user.inc";
    $user = new user("postmaster");
    $user->domainname = $domain;
    $user->ou = $ou;
    $user->mail = "postmaster@{$domain}";
    $user->password = time();
    if (!$user->add_user()) {
        echo "Failed to add Postmaster\n{$user->ldap_error}";
        return;
    }
    $user = new user("postmaster");
    $user->add_alias("hostmaster@{$domain}");
    $user->add_alias("webmaster@{$domain}");
    $user->add_alias("abuse@{$domain}");
}
コード例 #17
0
ファイル: create-user.php プロジェクト: brucewu16899/artica
function save()
{
    $tpl = new templates();
    $users = new user($_GET["login"]);
    if ($users->password != null) {
        writelogs("User already exists {$_GET["login"]} ", __FUNCTION__, __FILE__);
        echo $tpl->_ENGINE_parse_body('{account_already_exists}');
        exit;
    }
    writelogs("Add new user {$_GET["login"]} {$_GET["ou"]} {$_GET["gpid"]}", __FUNCTION__, __FILE__);
    $users->ou = $_GET["ou"];
    $users->password = $_GET["password"];
    $users->mail = "{$_GET["email"]}@{$_GET["internet_domain"]}";
    $users->DisplayName = "{$_GET["firstname"]} {$_GET["lastname"]}";
    $users->givenName = $_GET["firstname"];
    $users->sn = $_GET["lastname"];
    $users->group_id = $_GET["gpid"];
    $users->add_user();
}
コード例 #18
0
function importZimbra($hash, $ou)
{
    $uid = $hash["uid"][0];
    $displayname = $hash["displayname"][0];
    $postalcode = $hash["postalcode"][0];
    $street = $hash["street"][0];
    $telephonenumber = $hash["telephonenumber"][0];
    $homephone = $hash["homephone"][0];
    $mobile = $hash["mobile"][0];
    $mail = $hash["mail"][0];
    $givenname = $hash["givenname"][0];
    $sn = $hash["sn"][0];
    $userpassword = $hash["userpassword"][0];
    $town = $hash["l"][0];
    if ($hash["zimbramaildeliveryaddress"][0] != null) {
        $aliases[] = $hash["zimbramaildeliveryaddress"][0];
    }
    if ($mail == null) {
        return;
    }
    if (preg_match("#^admin[@\\.]#", $mail)) {
        return;
    }
    if (preg_match("#^wiki[@\\.]#", $mail)) {
        return;
    }
    if (preg_match("#^spam\\.#", $mail)) {
        return;
    }
    if (preg_match("#^ham\\.#", $mail)) {
        return;
    }
    if (count($hash["zimbramailalias"]["count"] > 0)) {
        for ($i = 0; $i < $hash["zimbramailalias"]["count"], $i++;) {
            $aliases[] = $hash["zimbramailalias"][$i];
        }
    }
    if (preg_match("#(.+?)@(.+)#", $mail, $re)) {
        $domain = $re[2];
    }
    $user = new user($uid);
    $user->ou = $ou;
    $user->mail = $mail;
    if ($userpassword != null) {
        $user->password = $userpassword;
    }
    if ($givenname != null) {
        $user->givenName = $givenname;
    }
    if ($sn != null) {
        $user->sn = $sn;
    }
    if ($street != null) {
        $user->street = $street;
    }
    if ($displayname) {
        $user->DisplayName = $displayname;
    }
    if ($telephonenumber != null) {
        $user->telephoneNumber = $telephonenumber;
    }
    if ($homephone != null) {
        $user->homePhone = $homephone;
    }
    if ($mobile != nul) {
        $user->mobile = $mobile;
    }
    if ($postalcode != null) {
        $user->postalCode = $postalcode;
    }
    if ($town != null) {
        $user->town = $town;
    }
    $user->domainname = $domain;
    echo "Adding/updating {$uid} {$mail} in ou \"{$ou}\"\n";
    $user->add_user();
    if (is_array($aliases)) {
        $user = new user($uid);
        while (list($ip, $li) = each($aliases)) {
            $user->add_alias($li);
        }
    }
}
コード例 #19
0
ファイル: add_user.php プロジェクト: TheHanif/POS-10
echo isset($_GET['id']) ? 'Update' : 'Add';
?>
 User</h3>
		  </div>
		  <div class="panel-body">
			<!-- BEGIN DATA TABLE -->
			<?php 
$user = new user();
$ID = isset($_GET['id']) ? $_GET['id'] : NULL;
if (isset($_POST['add_user'])) {
    // Update old record
    if (isset($ID)) {
        $results = $user->update_user($_POST, $ID);
    } else {
        // Insert new
        $results = $user->add_user($_POST);
    }
    if ($results) {
        echo '<div class="alert alert-success alert-block fade in alert-dismissable">
					  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
					  <strong>Add Staff Member</strong> Sucessfully
					</div>';
    } else {
        echo '<div class="alert alert-danger alert-block fade in alert-dismissable">
					  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
					  <strong>Error</strong>
					</div>';
    }
}
if (isset($ID)) {
    $user_result = $user->get_user($ID);
コード例 #20
0
ファイル: configure.server.php プロジェクト: rsd/artica-1.5
function main_fetchmail_build(){
	include_once('ressources/class.user.inc');
	include_once('ressources/class.main_cf.inc');
	include_once('ressources/class.fetchmail.inc');
	
	
$failed=false;	
	
$isp_address_mail=$_GET["isp_address_mail"];
$isp_pop3_server=$_GET["isp_pop3_server"];
$isp_smtp_server=$_GET["isp_smtp_server"];
	
$isp_account=$_GET["isp_account"];
$isp_password=$_GET["isp_password"];
$local_email=$_GET["local_email"];
$local_password=$_GET["local_password"];
	
$isp_smtp_account=$_GET["isp_smtp_account"];
$isp_smtp_password=$_GET["isp_smtp_password"];
	
$relay_server=$_GET["relay_server"];


if($local_email==null){
	echo main_fetchmail_build_results(true,'local mail (False)');
	exit;
}

$ldap=new clladp();
writelogs("i try to found if user exists",__FUNCTION__,__FILE__);
$uid=$ldap->uid_from_email($local_email);
if($uid<>null){
	$user=new user($local_email);
	$ou=$user->ou;
}else{
	writelogs("no user found, create it",__FUNCTION__,__FILE__);
	$tb=explode("@",$local_email);
	$local_domain=$tb[1];  
	$user=new user($tb[0]);
	$ou=$ldap->ou_by_smtp_domain($local_domain);
	if($ou==null){
		$ou=$local_domain;
		writelogs("Adding new organization $ou",__FUNCTION__,__FILE__);
		$ldap->AddOrganization($ou);
	}	
	
}


	
	writelogs("Creating user",__FUNCTION__,__FILE__);
	$user=new user($local_email);
	$user->mail=$local_email;
	$user->password=$local_password;
	$user->ou=$ou;
	$user->SenderCanonical=$isp_address_mail;
	if(!$user->add_user()){
		echo main_fetchmail_build_results(true,$user->ldap_error);
		exit;
	}
	
	
	if($isp_smtp_account<>null){
		writelogs("Creating SMTP authentification for $isp_smtp_server width $isp_smtp_account",__FUNCTION__,__FILE__);
		$sasl=new smtp_sasl_password_maps();
		$sasl->add($isp_address_mail,$isp_smtp_account,$isp_password);
		$main=new main_cf();
		writelogs("Enable sasl engine in postfix",__FUNCTION__,__FILE__);
		$main->smtp_sasl_password_maps_enable_2();		
		
	}
	writelogs("Creating sender_dependent_relayhost_maps -> $isp_smtp_server",__FUNCTION__,__FILE__);
	$sender=new sender_dependent_relayhost_maps();
	if(!$sender->Add($isp_address_mail,$isp_smtp_server)){
		echo main_fetchmail_build_results(true,"sender_dependent_relayhost_maps:$sender->ldap_error");
		exit;
	}
	

	$fetchmail=new Fetchmail_settings();
	$array["poll"]=$isp_pop3_server;
	$array["proto"]="auto";
	$array["keep"]="yes";
	$array["user"]=$isp_account;
	$array["pass"]=$isp_password;
	$array["is"]=$local_email;
	$array["fetchall"]="yes";
	$line=$fetchmail->compile($array);
	if(!$user->fetchmail_add_rule($line)){
		echo main_fetchmail_build_results(true,"fetchmail rule:$user->ldap_error");
		exit;
	}
	
	$relay=new Routing($ou);
	if($relay_server<>null){
		if(!$relay->create_relay_server($local_domain,$relay_server,$ou)){
				echo main_fetchmail_build_results(true,"relay:$relay->ldap_error");
			}
		}else{
			if(!$relay->create_localdomain($ou,$local_domain)){
				echo main_fetchmail_build_results(true,"local domain:$relay->ldap_error");
			}
		}

	
	$fetchmail=new fetchmail();
	$fetchmail->Save();
	$main=new main_cf();
	$main->save_conf();
	$main->save_conf_to_server();
	
	
	
	$info="<table style='width:100%'>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{organization}</strong>:</td>
		<td nowrap><strong>$ou</strong></td>
	</tr>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{local_mail}</strong>:</td>
		<td nowrap><strong>$local_email</strong></td>
	</tr>
	<tr>
		<td width=1%><img src='img/fw_bold.gif'></td>
		<td nowrap align='right'><strong>{isp_address_mail}</strong>:</td>
		<td nowrap><strong>$isp_address_mail</strong></td>
	</tr>			
	</table>	
	";
	
	echo main_fetchmail_build_results(false,$info);
	
	
}
コード例 #21
0
function autoaccount_submit()
{
    if (!CheckAutousers()) {
        exit;
    }
    $login = $_GET["login"];
    $email = "{$login}@{$_GET["domain"]}";
    $tpl = new templates();
    $ldap = new clladp();
    $uid = $ldap->uid_from_email($email);
    if ($uid != null) {
        echo $tpl->_ENGINE_parse_body('{account_already_exists}');
        exit;
    }
    $ou = $ldap->ou_by_smtp_domain($_GET["domain"]);
    $user = new user();
    $user->DisplayName = $_GET["first_name"] . " " . $_GET["last_name"];
    $user->sn = $_GET["first_name"];
    $user->cn = $_GET["last_name"];
    $user->mail = $email;
    $user->domainname = $_GET["domain"];
    $user->password = $_GET["password"];
    $user->ou = $ou;
    $user->uid = $login;
    if ($user->add_user()) {
        echo $tpl->_ENGINE_parse_body("{success}:{$email}\n");
    } else {
        echo $user->ldap_error;
    }
}
コード例 #22
0
function import($ou, $path)
{
    $usersM = new usersMenus();
    $unix = new unix();
    if (!is_file($path)) {
        echo "{$path}, no such file\n";
        die;
    }
    $ldap = new clladp();
    $oudn = "ou={$ou},dc=organizations,{$ldap->suffix}";
    if (!$ldap->ExistsDN($oudn)) {
        $ldap->AddOrganization($ou);
    }
    $tmpfile = $unix->FILE_TEMP();
    uncompress($path, $tmpfile);
    $datas = unserialize(base64_decode(@file_get_contents($tmpfile)));
    if (!is_array($datas)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Unable to import {$ou} {$path}, no such array\n";
            return;
        }
        $unix->send_email_events(basename(__FILE__) . "::Unable to import {$ou} {$path}, no such array", null, "import");
        die;
    }
    $usersArray = $datas["USERS"];
    $groupsArray = $datas["GROUPS"];
    unset($datas);
    echo "Creating groups in `{$ou}`";
    while (list($num, $hash) = each($groupsArray)) {
        $ORG_GID = $hash["main_array"]["gid"];
        $gp = new groups();
        $gpid = $gp->GroupIDFromName($ou, $hash["groupName"]);
        if (!is_numeric($gpid)) {
            $gp->groupName = $hash["groupName"];
            $gp->add_new_group($hash["groupName"], $ou);
            $gpid = $gp->GroupIDFromName($ou, $hash["groupName"]);
        }
        $gp = new groups($gpid);
        $members = $hash["members"];
        while (list($a, $b) = each($members)) {
            echo "Insert {$b} user to {$hash["groupName"]}/{$gpid}\n";
            $gp->AddUsertoThisGroup($b);
        }
        $gp->saveDescription($hash["main_array"]["description"]);
        $gp->ArticaGroupPrivileges = $hash["main_array"]["ArticaGroupPrivileges"];
        $gp->Privileges_array = $hash["Privileges_array"];
        $gp->SavePrivileges();
        $GROUPSORGS[$ORG_GID] = $gpid;
    }
    while (list($num, $hash) = each($usersArray)) {
        $array_groups = $hash["array_groups"];
        unset($hash["dn"]);
        unset($hash["UserExists"]);
        unset($hash["ou"]);
        unset($hash["local_sid"]);
        unset($hash["objectClass_array"]);
        unset($hash["group_id"]);
        unset($hash["sambaPrimaryGroupSID"]);
        unset($hash["accountGroup"]);
        unset($hash["uidNumber"]);
        unset($hash["sambaSID"]);
        unset($hash["sambaPrimaryGroupGID"]);
        unset($hash["gidNumber_array"]);
        $samba_groups = $hash["samba_groups"];
        unset($hash["ldapClass"]);
        unset($hash["attributs_array"]);
        unset($hash["samba_groups"]);
        $users = new user($hash["uid"]);
        $users->ou = $ou;
        $users->group_id = $GROUPSORGS[$array_groups[0]];
        while (list($a, $orgd) = each($hash)) {
            $users->a = $orgd;
        }
        $users->add_user();
        if ($usersM->SAMBA_INSTALLED) {
            if (!$hash["NotASambaUser"]) {
                $users->Samba_edit_user();
            }
        }
    }
}
コード例 #23
0
function create_user($filename)
{
    $tpl = new templates();
    $unix = new unix();
    $nohup = null;
    $path = "/usr/share/artica-postfix/ressources/logs/web/create-users/{$filename}";
    echo "Path:{$path}\n";
    build_progress("Open {$filename}", 10);
    if (!is_file($path)) {
        echo "{$path} no such file...\n";
        return false;
    }
    $MAIN = unserialize(base64_decode(@file_get_contents($path)));
    build_progress("Create new member {$MAIN["login"]}", 15);
    $users = new user($MAIN["login"]);
    if ($users->password != null) {
        echo "User already exists {$MAIN["login"]}\n";
        build_progress("{account_already_exists}", 110);
        @unlink($path);
        return;
    }
    $ou = $MAIN["ou"];
    $password = url_decode_special_tool($MAIN["password"]);
    $MAIN["firstname"] = url_decode_special_tool($MAIN["firstname"]);
    $MAIN["lastname"] = url_decode_special_tool($MAIN["lastname"]);
    build_progress("{$MAIN["firstname"]} {$MAIN["lastname"]}", 20);
    if (trim($MAIN["internet_domain"]) == null) {
        $MAIN["internet_domain"] = "localhost.localdomain";
    }
    echo "Add new user {$MAIN["login"]} {$MAIN["ou"]} {$MAIN["gpid"]}\n";
    $users->ou = $MAIN["ou"];
    $users->password = url_decode_special_tool($MAIN["password"]);
    $users->mail = "{$MAIN["email"]}@{$MAIN["internet_domain"]}";
    $users->DisplayName = "{$MAIN["firstname"]} {$MAIN["lastname"]}";
    $users->givenName = $MAIN["firstname"];
    $users->sn = $MAIN["lastname"];
    $users->group_id = $MAIN["gpid"];
    $users->homeDirectory = "/home/{$MAIN["login"]}";
    if (is_numeric($MAIN["gpid"])) {
        $gp = new groups($MAIN["gpid"]);
        echo "privileges: {$MAIN["gpid"]} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"\n";
        if ($gp->Privileges_array["AsComplexPassword"] == "yes") {
            $ldap = new clladp();
            $hash = $ldap->OUDatas($ou);
            $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true);
            $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"]));
            if (is_array($policiespwd)) {
                $priv = new privileges();
                if (!$priv->PolicyPassword($password, $policiespwd)) {
                    build_progress("Need complex password", 110);
                    echo "Need complex password";
                    @unlink($path);
                    return;
                }
            }
        }
    }
    build_progress("{$MAIN["firstname"]} {$MAIN["lastname"]} {save}", 25);
    if (!$users->add_user()) {
        echo $users->error . "\n" . $users->ldap_error;
        build_progress("{failed}", 110);
        @unlink($path);
        return;
    }
    @mkdir("{$users->homeDirectory}");
    @chown("{$users->homeDirectory}", $users->uid);
    if ($MAIN["ByZarafa"] == "yes") {
        $terminated = " >/dev/null";
        $zarafa_admin = $unix->find_program("zarafa-admin");
        if (!$GLOBALS["WAIT"]) {
            $nohup = $unix->find_program("nohup");
            $terminated = null;
        }
        if (isset($MAIN["ZARAFA_LANG"])) {
            $users->SaveZarafaMbxLang($MAIN["ZARAFA_LANG"]);
            $langcmd = " --lang {$MAIN["ZARAFA_LANG"]} ";
        }
        $ldap = new clladp();
        $dn = "ou={$MAIN["ou"]},dc=organizations,{$ldap->suffix}";
        $upd["objectClass"] = "zarafa-company";
        $upd["cn"] = $MAIN["ou"];
        if (!$ldap->Ldap_add_mod("{$dn}", $upd)) {
            echo $ldap->ldap_last_error;
            build_progress("{failed} OpenLDAP Error", 110);
            @unlink($path);
            return;
        }
        build_progress("{create_store} {language}: {$MAIN["ZARAFA_LANG"]}", 30);
        $cmd = "{$nohup} {$zarafa_admin} {$langcmd}--create-store {$MAIN["login"]} >/dev/null 2>&1 &";
        system(trim($cmd));
        if (!$GLOBALS["WAIT"]) {
            $sock = new sockets();
            $sock->getFrameWork("cmd.php?zarafa-hash=yes&rebuild=yes");
            return;
        }
        @unlink("/usr/share/artica-postfix/ressources/databases/ZARAFA_DB_STATUS.db");
        @unlink("/etc/artica-postfix/zarafa-export.db");
        $cmd = LOCATE_PHP5_BIN2() . " /usr/share/artica-postfix/exec.zarafa.build.stores.php --export-hash";
        build_progress("{export_stores_data}", 35);
        echo "{$cmd}\n";
        system($cmd);
    }
    echo "Remove {$path}\n";
    @unlink($path);
    return true;
}
コード例 #24
0
function checkrights()
{
    $tpl = new templates();
    $uid = $_GET["checkrights"];
    $user = new user($uid);
    $acls = "[mailbox]\n";
    while (list($num, $val) = each($_GET)) {
        if (preg_match('#mp_([a-zA-Z])#', $num, $re)) {
            writelogs("set acls {$re[1]}={$val} on mailbox", __FUNCTION__, __FILE__);
            $acls = $acls . "{$re[1]}={$val}\n";
        }
    }
    $user = new user($uid);
    $user->MailBoxMaxSize = $_GET["MailBoxMaxSize"];
    $user->MailboxActive = strtoupper($_GET["MailboxActive"]);
    $user->MailboxSecurityParameters = $acls;
    if (!$user->add_user()) {
        echo $user->ldap_error;
    }
    if ($user->MailboxActive != "TRUE") {
        echo $tpl->_ENGINE_parse_body("{$uid}:{mailbox_disabled} ({$user->MailboxActive})");
    }
}
コード例 #25
0
ファイル: wizard.smtp.php プロジェクト: BillTheBest/1.6.x
function SaveSettings()
{
    echo "<div><code>";
    $ldap = new clladp();
    $usersMenus = new usersMenus();
    $ldap->AddOrganization($_COOKIE["company"]);
    echo "</div></code>";
    echo "<div><code>";
    if (!$usersMenus->cyrus_imapd_installed) {
        $ldap->AddRelayDomain($_COOKIE["company"], $_COOKIE["smtp_domain"], $_COOKIE["smtp_relay"], 25);
    } else {
        $ldap->AddDomainEntity($_COOKIE["company"], $_COOKIE["smtp_domain"]);
    }
    echo "</div></code>";
    echo "<div><code>";
    $users = new user($_COOKIE["username"]);
    $users->mail = "{$_COOKIE["username"]}@{$_COOKIE["smtp_domain"]}";
    $users->password = $_COOKIE["password"];
    $users->ou = $_COOKIE["company"];
    $users->add_user();
    $users->add_alias("root");
    $users->add_alias("mailflt3");
    $users->add_alias("*****@*****.**");
    $users->add_alias("root@{$usersMenus->fqdn}");
    $users->add_alias("postmaster@{$usersMenus->fqdn}");
    $users->add_alias("*****@*****.**");
    $users->add_alias("postmaster");
    echo "</div></code>";
    $sock = new sockets();
    $sock->SET_INFO("PostmasterAdress", $users->mail);
    $sock->SET_INFO("MasterSMTPDomainName", $_COOKIE["smtp_domain"]);
    $sock->SET_INFO("SmtpWizardFinish", 1);
    if ($usersMenus->AMAVIS_INSTALLED) {
        echo "<div><code>";
        include_once "ressources/class.amavis.inc";
        $amavis = new amavis();
        $amavis->Save();
        $sock->SET_INFO("EnableAmavisDaemon", "1");
        $sock->getFrameWork("cmd.php?artica-filter-reload=yes");
        $amavis->SaveToServer();
        echo "</div></code>";
    }
    if ($usersMenus->BIND9_INSTALLED) {
        include_once "ressources/class.bind9.inc";
        include_once "ressources/class.system.network.inc";
        $net = new networking();
        if (is_array($net->arrayNameServers)) {
            $dns = implode("\n", $net->arrayNameServers);
            $sock->SaveConfigFile($dns, "PostfixBind9DNSList");
            $sock->SET_INFO('PostfixEnabledInBind9', 1);
        }
    }
    echo "<div><code>";
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
    echo "</div></code>";
}
コード例 #26
0
function import_users($id)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = trim(@file_get_contents($pidfile));
    if ($unix->process_exists($pid)) {
        echo "[" . getmypid() . "]:: Process {$pid} already running...\n";
        die;
    }
    $pid = getmypid();
    @file_put_contents($pidfile, $pid);
    $emailing = new emailings($id);
    if ($emailing->error) {
        echo __FUNCTION__ . " class error: {$emailing->mysql_error}\n";
        exit;
    }
    $sql = "SELECT * FROM {$emailing->tablename}";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo __FUNCTION__ . " {$q->mysql_error}\n";
        exit;
    }
    $max = mysql_num_rows($results);
    $ldap = new clladp();
    $domains = $ldap->Hash_domains_table($ou);
    while (list($domain, $no) = each($domains)) {
        $DOMAINS_ARRAY[$domain] = true;
    }
    if ($emailing->array_options["export_domain"] == null) {
        update_export_status($id, 110, "No default domain set");
        return;
    }
    if ($emailing->array_options["gpid"] == null) {
        update_export_status($id, 110, "No default group set");
        return;
    }
    $gpid = $emailing->array_options["gpid"];
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $count = $count + 1;
        $tw = $tw + 1;
        $firstname = $ligne["firstname"];
        $lastname = $ligne["lastname"];
        $email = $ligne["email"];
        $phone = $ligne["phone"];
        $city = $ligne["city"];
        $cp = $ligne["cp"];
        $postaladdress = $ligne["postaladdress"];
        if (!preg_match("#(.+?)@#", $email, $re)) {
            continue;
        }
        $uid = $re[1];
        $new_email = "{$uid}@{$emailing->array_options["export_domain"]}";
        $ct = new user($uid);
        if (!$ct->DoesNotExists) {
            $GLOBALS["SUCCESS_CONTACTS"] = $GLOBALS["SUCCESS_CONTACTS"] + 1;
            echo "{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} already exists [SUCCESS]\n";
        }
        $ct->mail = $new_email;
        $ct->postalCode = $cp;
        $ct->postalAddress = $postaladdress;
        $ct->town = $city;
        $ct->telephoneNumber = $phone;
        $ct->DisplayName = "{$firstname} {$lastname}";
        $ct->sn = $lastname;
        $ct->givenName = $firstname;
        $ct->group_id = $gpid;
        $ct->ou = $emailing->ou;
        $ct->password = $emailing->array_options["export_default_password"];
        if ($tw > 2) {
            $purc = $count / $max;
            $purc = $purc * 100;
            $purc = round($purc, 0);
            update_export_status($id, $purc);
            $tw = 0;
        }
        if (!$ct->add_user()) {
            writeevent("{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} [FAILED]");
            $GLOBALS["FAILED_CONTACTS"] = $GLOBALS["FAILED_CONTACTS"] + 1;
            continue;
        }
        $GLOBALS["SUCCESS_CONTACTS"] = $GLOBALS["SUCCESS_CONTACTS"] + 1;
        writeevent("{$emailing->ou}/{$uid}::{$new_email} {$firstname} {$lastname} [SUCCESS]");
        if ($new_email != $email) {
            $user = new user($uid);
            $user->add_alias($email);
        }
    }
    writeevent("Failed.:{$GLOBALS["FAILED_CONTACTS"]}", $id);
    writeevent("Success:{$GLOBALS["SUCCESS_CONTACTS"]}", $id);
    update_status($id, 100, 1, null);
}
コード例 #27
0
function create_user()
{
    $ldap = new clladp();
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql();
    $sql = "SELECT * FROM register_orgs WHERE `zmd5`='{$_GET["key"]}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $ou = $ligne["ou"];
    if ($ligne["ou"] == null) {
        echo $tpl->_ENGINE_parse_body("{please_register_first}");
        return;
    }
    $domain = $ligne["domain"];
    $user = $ligne["username"];
    $password = $ligne["password"];
    $u = new user($user);
    $u->mail = "{$user}@{$domain}";
    $u->domainname = $domain;
    $u->password = $password;
    $u->ou = $ou;
    if (!$u->add_user()) {
        $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-red.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{member}: {$user} {failed} {$u->error}</td>\n\t\t</tr>\n\t\t</table>";
        echo $tpl->_ENGINE_parse_body($html);
        return;
    }
    $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-green.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{member}: {$user} <i>{$u->mail}</i> {success}</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div id='step-4'></div>\n\t\t<script>\n\t\t\tLoadAjax('step-4','{$page}?create-group=yes&key={$_GET["key"]}');\n\t\t</script>\t\t\n\t\t";
    echo $tpl->_ENGINE_parse_body($html);
    return;
}
コード例 #28
0
function upload_form_perform()
{
    usleep(300);
    writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__);
    $sock = new sockets();
    $sock->getFrameWork("services.php?lighttpd-own=yes");
    if (isset($_GET['qqfile'])) {
        $fileName = $_GET['qqfile'];
        if (function_exists("apache_request_headers")) {
            $headers = apache_request_headers();
            if ((int) $headers['Content-Length'] == 0) {
                writelogs("content length is zero", __FUNCTION__, __FILE__, __LINE__);
                die('{error: "content length is zero"}');
            }
        } else {
            writelogs("apache_request_headers() no such function", __FUNCTION__, __FILE__, __LINE__);
        }
    } elseif (isset($_FILES['qqfile'])) {
        $fileName = basename($_FILES['qqfile']['name']);
        writelogs("_FILES['qqfile']['name'] = {$fileName}", __FUNCTION__, __FILE__, __LINE__);
        if ($_FILES['qqfile']['size'] == 0) {
            writelogs("file size is zero", __FUNCTION__, __FILE__, __LINE__);
            die('{error: "file size is zero"}');
        }
    } else {
        writelogs("file not passed", __FUNCTION__, __FILE__, __LINE__);
        die('{error: "file not passed"}');
    }
    writelogs("upload_form_perform() -> OK {$_GET['qqfile']}", __FUNCTION__, __FILE__, __LINE__);
    if (count($_GET)) {
        $datas = json_encode(array_merge($_GET, array('fileName' => $fileName)));
        writelogs($datas, __FUNCTION__, __FILE__, __LINE__);
    } else {
        writelogs("query params not passed", __FUNCTION__, __FILE__, __LINE__);
        die('{error: "query params not passed"}');
    }
    writelogs("upload_form_perform() -> OK {$_GET['qqfile']} upload_max_filesize=" . ini_get('upload_max_filesize') . " post_max_size:" . ini_get('post_max_size'), __FUNCTION__, __FILE__, __LINE__);
    include_once dirname(__FILE__) . "/ressources/class.file.upload.inc";
    $allowedExtensions = array();
    $sizeLimit = qqFileUploader::toBytes(ini_get('upload_max_filesize'));
    $sizeLimit2 = qqFileUploader::toBytes(ini_get('post_max_size'));
    if ($sizeLimit2 < $sizeLimit) {
        $sizeLimit = $sizeLimit2;
    }
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload/";
    $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
    $result = $uploader->handleUpload($content_dir);
    writelogs("upload_form_perform() -> OK {$resultTXT}", __FUNCTION__, __FILE__, __LINE__);
    $TargetpathUploaded = base64_decode($_GET["TargetpathUploaded"]);
    if (!is_file("{$content_dir}{$fileName}")) {
        die("{error: \"{$content_dir}{$fileName} no such file \"}");
    }
    $user = new user($_SESSION["uid"]);
    $jpegPhoto_datas = file_get_contents("{$content_dir}{$fileName}");
    $user->add_user();
    writelogs("PHOTO: Edit: " . strlen($jpegPhoto_datas) . " bytes", __FUNCTION__, __FILE__, __LINE__);
    if (!$user->SaveUserPhoto($jpegPhoto_datas)) {
        die("{error: \"{$user->ldap_error}\"}");
    }
    if (is_file($user->thumbnail_path)) {
        unlink($user->thumbnail_path);
    }
    $user->draw_jpeg_photos("{$content_dir}{$fileName}");
    echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
    return;
}
コード例 #29
0
function save()
{
    $tpl = new templates();
    $users = new user($_GET["login"]);
    if ($users->password != null) {
        writelogs("User already exists {$_GET["login"]} ", __FUNCTION__, __FILE__);
        echo $tpl->_ENGINE_parse_body('{account_already_exists}');
        exit;
    }
    $ou = $_REQUEST["ou"];
    $password = $_REQUEST["password"];
    writelogs("Add new user {$_REQUEST["login"]} {$_REQUEST["ou"]} {$_REQUEST["gpid"]}", __FUNCTION__, __FILE__);
    $users->ou = $_REQUEST["ou"];
    $users->password = $_REQUEST["password"];
    $users->mail = "{$_REQUEST["email"]}@{$_REQUEST["internet_domain"]}";
    $users->DisplayName = "{$_REQUEST["firstname"]} {$_REQUEST["lastname"]}";
    $users->givenName = $_REQUEST["firstname"];
    $users->sn = $_REQUEST["lastname"];
    $users->group_id = $_REQUEST["gpid"];
    if (is_numeric($_REQUEST["gpid"])) {
        $gp = new groups($_REQUEST["gpid"]);
        writelogs("privileges: {$_REQUEST["gpid"]} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__);
        if ($gp->Privileges_array["AsComplexPassword"] == "yes") {
            $ldap = new clladp();
            $hash = $ldap->OUDatas($ou);
            $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true);
            $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"]));
            if (is_array($policiespwd)) {
                $priv = new privileges();
                if (!$priv->PolicyPassword($password, $policiespwd)) {
                    return false;
                }
            }
        }
        return false;
    }
    $users->add_user();
}
コード例 #30
0
function USER_JUNK_LEARNING_SAVE(){
$uid=$_GET["uid"];	
$users=new user($uid);
$users->EnableUserSpamLearning=$_GET["EnableUserSpamLearning"];
$users->add_user();
}