Пример #1
0
function SambaRoamingEnabled()
{
    $sock = new sockets();
    $sock->SET_INFO('SambaRoamingEnabled', $_GET["SambaRoamingEnabled"]);
    $samba = new samba();
    $samba->SaveToLdap();
}
Пример #2
0
function xapsearch()
{
    $userid = $_SESSION["uid"];
    $ct = new user($userid);
    if ($userid != null) {
        $samba = new samba();
        $samba_folders = $samba->GetUsrsRights($userid);
    }
    $users = new usersMenus();
    writelogs("{$userid} ->AllowXapianDownload \"{$users->AllowXapianDownload}\"", __FUNCTION__, __FILE__);
    $xapian = new XapianSearch();
    if (!is_file("/usr/share/artica-postfix/LocalDatabases/home_{$userid}.db")) {
        $xapian->add_database("/usr/share/artica-postfix/LocalDatabases/home_{$userid}.db");
    }
    while (list($sharename, $path) = each($samba_folders)) {
        if (!is_file("/usr/share/artica-postfix/LocalDatabases/share_{$sharename}.db")) {
            $xapian->add_database("/usr/share/artica-postfix/LocalDatabases/share_{$sharename}.db");
        }
    }
    if (is_array($ct->HASH_ALL_MAILS)) {
        while (list($num, $mail) = each($ct->HASH_ALL_MAILS)) {
            $xapian->add_database("/usr/share/artica-postfix/LocalDatabases/mail_{$mail}.db");
        }
    }
    $current = $_GET["p"];
    if ($current == null) {
        $current = 0;
    }
    $xapian->terms = $_GET["xapsearch"];
    $xapian->start = $current;
    if (count($xapian->databases) > 0) {
        $array = $xapian->search();
    }
    $maxdocs = $array["ESTIMATED"];
    if ($maxdocs > 10) {
        $tabs = generateTabs($maxdocs, $current);
    }
    if (is_array($array["RESULTS"])) {
        while (list($num, $arr) = each($array["RESULTS"])) {
            $tr[] = FormatResponse($arr, $users, $ct->password);
        }
    }
    $html = "<div style='font-size:12px;font-weight:bold;margin:5px;text-align:right'>{found} {$array["ESTIMATED"]} {documents} in <strong>" . count($xapian->ParsedDatabases) . " {databases}</strong></div>";
    $tpl = new templates();
    if (is_array($tr)) {
        echo $tpl->_ENGINE_parse_body($html . $tabs . implode("\n", $tr));
    } else {
        if ($_GET["tmpmax"] > 0) {
            $tabs = generateTabs($maxdocs, $current);
        }
        echo $tpl->_ENGINE_parse_body($html . $tabs . '<p style="font-size:14px;font-weight:bold;margin:10px">{ERR_NO_DOC_FOUND}</p>');
    }
}
Пример #3
0
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $smb = new samba();
    $dirs = $smb->LOAD_RECYCLES_BIN();
    while (list($DirUid, $none) = each($dirs)) {
        $trashes[$DirUid] = $DirUid;
    }
    $trashes[null] = "{all}";
    $html = "\n\t<center style='margin-bottom:10px'>\n\t<table style='width:70%' class=form>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{files}:</td>\n\t\t\t\t<td colspan=3>" . Field_text("search-file-trash", "*", "font-size:14px;padding:3px;", null, null, null, false, "SearchTrashFileCheck(event)") . "</td>\n\t\t\t\t<td width=1%>" . button("{search}", "SearchTrashFile()") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{share}:</td>\n\t\t\t\t<td>" . Field_array_Hash($trashes, "sharename", $_GET["sharename"], "style:font-size:14px") . "</td>\n\t\t\t\t<td class=legend>{date}:</td>\n\t\t\t\t<td>" . Field_text("search-date-trash", "0000-00-00", "font-size:14px;padding:3px;width:90px", null, null, null, false, "SearchTrashFileCheck(event)") . "</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n\t</center>\n\t<div id='trash-samba-list' style='width:100%;height:550px;overflow:auto'></div>\n\t<script>\n\tfunction SearchTrashFileCheck(e){\n\t\tif(checkEnter(e)){SearchTrashFile();}\n\t}\n\t\n\tfunction SearchTrashFile(){\n\t\tvar date=escape(document.getElementById('search-date-trash').value);\n\t\tvar sharename=escape(document.getElementById('sharename').value);\n\t\tvar searchfile=escape(document.getElementById('search-file-trash').value);\n\t\tLoadAjax('trash-samba-list','{$page}?search='+searchfile+'&date='+date+'&sharename='+sharename);\n\t\n\t}\n\t\n\tSearchTrashFile();\n\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #4
0
function save()
{
    $sock = new sockets();
    if (isset($_GET["EnableScannedOnly"])) {
        $sock->SET_INFO("EnableScannedOnly", $_GET["EnableScannedOnly"]);
    }
    if (isset($_GET["EnableKav4Samba"])) {
        $sock->SET_INFO("EnableKav4Samba", $_GET["EnableKav4Samba"]);
    }
    if (isset($_GET["EnableSambaXapian"])) {
        $sock->SET_INFO("EnableSambaXapian", $_GET["EnableSambaXapian"]);
    }
    $samab = new samba();
    $samab->SaveToLdap();
}
Пример #5
0
function change()
{
    if (strlen(trim($_POST["change_password"])) > 1) {
        $sock = new sockets();
        $sock->SET_INFO("RootPasswordChanged", 1);
        writelogs(" -> nsswitch ", __FUNCTION__, __FILE__, __LINE__);
        $sock->getFrameWork("services.php?nsswitch=yes");
        $change_password = url_decode_special($_POST["change_password"]);
        $changeRootPasswd = urlencode(base64_encode($change_password));
        writelogs(" -> services.php?changeRootPasswd= ", __FUNCTION__, __FILE__, __LINE__);
        $sock->getFrameWork("services.php?changeRootPasswd={$changeRootPasswd}");
        include_once dirname(__FILE__) . "/ressources/class.samba.inc";
        $smb = new samba();
        $smb->createRootID($change_password);
    }
}
Пример #6
0
function save()
{
    $samba = new samba();
    $array["nt_acl_support"] = "nt acl support";
    $array["map_acl_inherit"] = "map acl inherit";
    $array["acl_check_permissions"] = "acl check permissions";
    $array["acl_group_control"] = "acl group control";
    $array["inherit_permissions"] = "inherit permissions";
    $array["inherit_acls"] = "inherit acls";
    while (list($key, $value) = each($array)) {
        $NEW_GET[$value] = $_GET[$key];
    }
    while (list($key, $value) = each($NEW_GET)) {
        $samba->main_array["global"][$key] = $value;
    }
    $samba->SaveToLdap();
}
Пример #7
0
function change(){
	if(strlen(trim($_POST["change_password"]))>1){
			$sock=new sockets();
			$sock->SET_INFO("RootPasswordChanged", 1);
			$change_password=url_decode_special($_POST["change_password"]);
			include_once(dirname(__FILE__))."/ressources/class.samba.inc";
			$smb=new samba();
			$smb->createRootID($change_password);
	}		
}
Пример #8
0
function SaveGlobal()
{
    $samba = new samba();
    $shared_name = $_GET["ShareName"];
    $php5 = LOCATE_PHP5_BIN();
    $folder_name = $samba->GetShareName("/media/{$_GET["uuid"]}");
    if ($folder_name == null) {
        $samba->main_array["{$shared_name}"]["path"] = "/media/{$_GET["uuid"]}";
        $samba->main_array["{$shared_name}"]["create mask"] = "0777";
        $samba->main_array["{$shared_name}"]["directory mask"] = "0777";
        $samba->main_array["{$shared_name}"]["root preexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-mount {$_GET["uuid"]} %u";
        $samba->main_array["{$shared_name}"]["root postexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-umount {$_GET["uuid"]} %u";
        $samba->main_array["{$shared_name}"]["root preexec close"] = "yes";
        $samba->SaveToLdap();
    } else {
        $samba->main_array["{$folder_name}"]["path"] = "/media/{$_GET["uuid"]}";
        $samba->main_array["{$folder_name}"]["create mask"] = "0777";
        $samba->main_array["{$folder_name}"]["directory mask"] = "0777";
        $samba->main_array["{$folder_name}"]["root preexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-mount {$_GET["uuid"]} %u";
        $samba->main_array["{$folder_name}"]["root postexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-umount {$_GET["uuid"]} %u";
        $samba->main_array["{$folder_name}"]["root preexec close"] = "yes";
        $samba->SaveToLdap();
    }
}
Пример #9
0
function change()
{
    $sock = new sockets();
    $nsswitchEnableLdap = intval($sock->GET_INFO("nsswitchEnableLdap"));
    if (strpos(" {$_POST["change_password"]}", ":") > 0) {
        echo "`:` not supported !\n";
        return;
    }
    if (strlen(trim($_POST["change_password"])) > 1) {
        $_POST["change_password"] = url_decode_special_tool($_POST["change_password"]);
        if ($nsswitchEnableLdap == 1) {
            include_once dirname(__FILE__) . "/ressources/class.samba.inc";
            $smb = new samba();
            if (!$smb->createRootID($_POST["change_password"])) {
                return;
            }
        }
        $sock->SET_INFO("RootPasswordChanged", 1);
        $change_password = url_decode_special($_POST["change_password"]);
        $changeRootPasswd = base64_encode($change_password);
        writelogs(" -> services.php?changeRootPasswd= ", __FUNCTION__, __FILE__, __LINE__);
        echo base64_decode($sock->getFrameWork("services.php?changeRootPasswd={$changeRootPasswd}&pass={$changeRootPasswd}"));
    }
}
Пример #10
0
function neighborhood_save(){

	$sock=new sockets();
	$samba=new samba();
	switch ($_POST["neighborhood-save"]) {
		case "SINGLE_MODE":
			$samba->main_array["global"]["domain logons"]="no";
			$samba->main_array["global"]["preferred master"]="no";
			$samba->main_array["global"]["domain master"]="no";
			$samba->main_array["global"]["local master"]="no";
			$samba->main_array["global"]["os level"]=20;
			$sock->SET_INFO("TypeOfSamba",1);
			$samba->SaveToLdap();
			break; 
			
		case "LOCAL_MASTER":
			$samba->main_array["global"]["domain logons"]="no";
			$samba->main_array["global"]["preferred master"]="yes";
			$samba->main_array["global"]["domain master"]="no";
			$samba->main_array["global"]["local master"]="yes";
			$samba->main_array["global"]["os level"]=33;
			$sock->SET_INFO("TypeOfSamba",2);
			$samba->SaveToLdap();
			break; 			
		
		case "ROLE_DOMAIN_PDC":
			$samba->main_array["global"]["domain logons"]="yes";
			$samba->main_array["global"]["preferred master"]="yes";
			$samba->main_array["global"]["domain master"]="yes";
			$samba->main_array["global"]["local master"]="yes";
			$samba->main_array["global"]["os level"]=40;
			$sock->SET_INFO("TypeOfSamba",3);
			$samba->SaveToLdap();	
			break; 
			
		default:
			$samba->main_array["global"]["domain logons"]="no";
			$samba->main_array["global"]["preferred master"]="no";
			$samba->main_array["global"]["domain master"]="no";
			$samba->main_array["global"]["local master"]="no";
			$samba->main_array["global"]["os level"]=20;
			$samba->SaveToLdap();		
			$sock->SET_INFO("TypeOfSamba",1);	
			break;
	}
	
	$sock=new sockets();
	$sock->getFrameWork("cmd.php?samba-reconfigure=yes");
	$sock->SET_INFO("SambaSecurityLevel", $_POST["SambaSecurityLevel"]);
	$tpl=new templates();
	echo $tpl->_ENGINE_parse_body("{need_reboot}");
	
	//You may need to restart your computer before changes take effect
	
	
}
Пример #11
0
<?php

if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
include_once dirname(__FILE__) . '/ressources/class.templates.inc';
include_once dirname(__FILE__) . '/ressources/class.ini.inc';
include_once dirname(__FILE__) . '/ressources/class.samba.inc';
include_once dirname(__FILE__) . '/samba.sid.php';
system('/usr/share/artica-postfix/bin/artica-install --samba-reconfigure');
$ldap = new clladp();
$samba = new samba();
$sid = $ldap->LOCAL_SID();
$samba->ChangeSID($sid);
SMBCHANGECOMPUTERS();
SMBGROUPS();
SMBCHANGEUSERS();
SMBRESTART();
die;
Пример #12
0
function XapianFileInfo()
{
    if (!preg_match("#^(.+?);pass=(.+?);XapianWords=(.+)#", $_GET["creds"], $re)) {
        echo "<H1>Bad credentials</H1>";
        die;
    }
    $uid = $re[1];
    $ct = new user($uid);
    if ($ct->uidNumber < 2) {
        die("{$uid} does not exists");
    }
    if (md5($ct->password) != $re[2]) {
        die("bad password");
    }
    if (!is_object($GLOBALS["USERMENUS"])) {
        $users = new usersMenus();
        $GLOBALS["USERMENUS"] = $users;
    } else {
        $users = $GLOBALS["USERMENUS"];
    }
    if (!is_object($GLOBALS["SMBCLASS"])) {
        $smb = new samba();
        $GLOBALS["SMBCLASS"] = $smb;
    } else {
        $smb = $GLOBALS["SMBCLASS"];
    }
    $ldap = new clladp();
    $path = base64_decode($_GET["XapianFileInfo"]);
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=" . base64_encode($path))));
    $type = base64_decode($sock->getFrameWork("cmd.php?filetype=" . base64_encode($path)));
    $permissions = $array["perms"]["human"];
    $permissions_dec = $array["perms"]["octal1"];
    $accessed = $array["time"]["accessed"];
    $modified = $array["time"]["modified"];
    $created = $array["time"]["created"];
    $file = $array["file"]["basename"];
    $permissions_g = $array["owner"]["group"]["name"] . ":" . $array["owner"]["owner"]["name"];
    $ext = Get_extension($file);
    $page = CurrentPageName();
    $cr = new SimpleCrypt($ldap->ldap_password);
    $path_encrypted = base64_encode($cr->encrypt($path));
    $samba = new samba();
    $samba_folders = $samba->GetUsrsRights($uid);
    $download = Paragraphe("download-64.png", "{download}", "{download} {$file}<br>" . FormatBytes($array["size"]["size"] / 1024), "javascript:s_PopUp('{$page}?download-file={$path_encrypted}',10,10)");
    if (!IfDirectorySambaRights($samba_folders, $path)) {
        $download = null;
    }
    $img = "img/ext/def.jpg";
    if (is_file("img/ext/{$ext}.jpg")) {
        $img = "img/ext/{$ext}.jpg";
    }
    $html = "<H1>{$file}</H1>\n<code>{$path}</code>\n<div style='font-size:11px;margin-top:3px;padding-top:5px;border-top:1px solid #CCCCCC;text-align:right;'><i>{$type}</i></div>\n<table style='width:100%'>\n<tr>\n<td width=1% valign='top'><img src='{$img}' style='margin:15px'></td>\n<td valign='top'>\n<hr>\n<table>\n\t<tr>\n\t\t<td class=legend>{permission}:</td>\n\t\t<td><strong>{$permissions} {$permissions_g} ({$permissions_dec})</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{accessed}:</td>\n\t\t<td><strong>{$accessed}</td>\n\t</tr>\n<tr><td class=legend>{modified}:</td><td><strong>{$modified}</td></tr>\n<tr><td class=legend>{created}:</td><td><strong>{$created}</td></tr>\n<tr>\n\t<td class=legend>{size}:</td>\n\t<td><strong>{$array["size"]["size"]} bytes (" . FormatBytes($array["size"]["size"] / 1024) . ")</td>\n</tr>\n<tr>\n\t<td class=legend>blocks:</td>\n\t<td><strong>{$array["size"]["blocks"]}</td>\n</tr>\t\n<tr>\n\t<td class=legend>block size:</td>\n\t<td><strong>{$array["size"]["block_size"]}</td>\n</tr>\n</table>\n</td>\n<td valign='top'>\n{$download}\n</td>\n</tr>\n</table>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #13
0
function TASK_SETTINGS_SOCKETS($key)
{
    $EXEC_NICE = EXEC_NICE();
    $meta = new artica_meta(true);
    events("Get key informations from {$key}", __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_SOCKETS_INFO" => $key));
    if (!preg_match("#<RESULTS>(.+?)</RESULTS>#", $body, $re)) {
        events("Get key informations from {$key} FAILED", __FUNCTION__, __FILE__, __LINE__);
        return false;
    }
    $value = base64_decode($re[1]);
    $sock = new sockets();
    events("Saving key {$key}", __FUNCTION__, __FILE__, __LINE__);
    $filewrite = @file_put_contents("/etc/artica-postfix/settings/Daemons/{$key}", $value, LOCK_EX);
    if (!$filewrite) {
        events("Save configuration settings [{$key}] = " . strlen($value) . " Failed", __FUNCTION__, __FILE__, __LINE__);
        send_email_events("failed to modify settings \"{$key}\"", null, "CLOUD");
    }
    events("Save configuration settings [{$key}] ={$filewrite} bytes SUCCESS", __FUNCTION__, __FILE__, __LINE__);
    switch ($key) {
        case "NetworkScannerMasks":
            $sock->getFrameWork("cmd.php?squid-rebuild=yes");
            $sock->getFrameWork("cmd.php?postfix-networks=yes");
            send_email_events("Success to modify settings \"{$key}\"", "Postfix or Squid was scheduled to be reloaded.\n", "CLOUD");
            break;
        case "DDClientConfig":
            $sock->getFrameWork("cmd.php?squid-rebuild=yes");
            $sock->getFrameWork("cmd.php?ddclient=yes");
            send_email_events("Success to modify settings \"{$key}\"", "DDClient And Squid was scheduled to be reloaded.\n", "CLOUD");
            break;
        case "EnableDDClient":
            $sock->getFrameWork("cmd.php?ddclient=yes");
            send_email_events("Success to modify settings \"{$key}\"", "DDClient was scheduled to be reloaded.\n", "CLOUD");
            break;
    }
    $SQUID["SQUIDEnable"] = true;
    $SQUID["ArticaSquidParameters"] = true;
    $SQUID["hasProxyTransparent"] = true;
    $SQUID["EnableClamavInCiCap"] = true;
    $SQUID["EnableUfdbGuard"] = true;
    $SQUID["EnableAdZapper"] = true;
    $SQUID["EnableSquidClamav"] = true;
    $SQUID["SquidBlockSites"] = true;
    $SQUID["ArticaEnableKav4ProxyInSquid"] = true;
    $SQUID["DansGuardianEnabled"] = true;
    $SQUID["SquidExternalAuth"] = true;
    $SQUID["SquidFTPParams"] = true;
    $SAMBA["SambaSMBConf"] = true;
    $COMMAND["PostfixBinInterfaces"] = "cmd.php?postfix-interfaces=yes";
    $COMMAND["PostfixMynetworks"] = "cmd.php?postfix-networks=yes";
    $COMMAND["myhostname"] = "cmd.php?postfix-others-values=yes";
    $COMMAND["HashMainCf"] = "cmd.php?postfix-others-values=yes";
    $COMMAND["smtp_bind_address6"] = "cmd.php?postfix-interfaces=yes";
    $COMMAND["PostfixEnableIpv6"] = "cmd.php?postfix-interfaces=yes";
    $COMMAND["EnableCluebringer"] = "cmd.php?cluebringer-restart=yes";
    $COMMAND["EnableASSP"] = "cmd.php?restart-assp=yes";
    $COMMAND["KasxFilterEnabled"] = "cmd.php?SaveMaincf=yes";
    $COMMAND["EnableArticaSMTPFilter"] = "cmd.php?artica-filter-reload=yes";
    $COMMAND["EnableAmavisDaemon"] = "cmd.php?SaveMaincf=yes";
    $COMMAND["SpamAssMilterEnabled"] = "cmd.php?SaveMaincf=yess";
    $COMMAND["kavmilterEnable"] = "cmd.php?SaveMaincf=yes";
    $COMMAND["SpamAssMilterEnabled"] = "cmd.php?SaveMaincf=yes";
    $COMMAND["EnableArticaPolicyFilter"] = "cmd.php?artica-policy-restart=yes";
    $COMMAND["ArticaOpenVPNSettings"] = "cmd.php?restart-openvpn-server=yes";
    $COMMAND["EnableOPenVPNServerMode"] = "cmd.php?restart-openvpn-server=yes";
    $COMMAND["OpenVPNRoutes"] = "cmd.php?restart-openvpn-server=yes";
    $RESTART_STATUS["ArticaOpenVPNSettings"] = true;
    $RESTART_STATUS["EnableOPenVPNServerMode"] = true;
    $REBUILD_OPENVPN_CERTS["ArticaOpenVPNSettings"] = true;
    $REBUILD_OPENVPN_CERTS["EnableOPenVPNServerMode"] = true;
    if ($REBUILD_OPENVPN_CERTS[$key]) {
        shell_exec("/bin/rm -rf /etc/artica-postfix/openvpn/keys/*");
        exec("/etc/init.d/artica-postfix restart openvpns", $results);
        send_email_events("OpenVPN certificate was rebuilded", @implode("\n", $results), "VPN");
        shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-openvpn-users &");
    }
    if ($SQUID[$key]) {
        $sock->getFrameWork("cmd.php?squid-rebuild=yes");
        $sock->getFrameWork("cmd.php?squidnewbee=yes");
        send_email_events("Success to modify settings \"{$key}\"", "Squid was scheduled to be reloaded.\n", "CLOUD");
    }
    if ($SAMBA[$key]) {
        include_once dirname(__FILE__) . "/ressources/class.samba.inc";
        events("Loading samba class and save new samba configuration....", __FUNCTION__, __FILE__, __LINE__);
        $smb = new samba();
        $smb->SaveToLdap();
    }
    if ($COMMAND[$key] != null) {
        $sock->getFrameWork($COMMAND[$key]);
        events("Execute {$COMMAND[$key]}", __FUNCTION__, __FILE__, __LINE__);
    } else {
        events("No command for \"{$key}\"", __FUNCTION__, __FILE__, __LINE__);
    }
    if ($RESTART_STATUS[$key]) {
        events("restarting artica status....", __FUNCTION__, __FILE__, __LINE__);
        @unlink("/usr/share/artica-postfix/ressources/logs/global.status.ini");
        $sock->getFrameWork("cmd.php?restart-artica-status=yes");
    } else {
        events("No need to restart artica-status....", __FUNCTION__, __FILE__, __LINE__);
    }
    sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-settings");
    events("FINISH, Return true", __FUNCTION__, __FILE__, __LINE__);
    return true;
}
Пример #14
0
function SMBRESTART()
{
    $smb = new samba();
    $smb->SaveToLdap();
    $tpl = new templates();
    if (posix_getuid() != 0) {
        echo $tpl->_ENGINE_parse_body("<hr>{CHANGE_SID_GROUPS}", "samba.index.php");
    }
}
Пример #15
0
function SimpleShareDelCompToPath()
{
    $uid = $_GET["del-uid"];
    $samba = new samba();
    $keypath = $samba->GetShareName(base64_decode($_GET["path"]));
    $hosts = explode(" ", $samba->main_array[$keypath]["hosts allow"]);
    if (is_array($hosts)) {
        while (list($index, $host) = each($hosts)) {
            if ($host == null) {
                continue;
            }
            $hote[$host] = $host;
        }
    }
    unset($hote[$uid]);
    if (is_array($hote)) {
        while (list($index, $host) = each($hote)) {
            $final[] = $host;
        }
    }
    if (count($final) > 0) {
        $samba->main_array[$keypath]["hosts allow"] = @implode(" ", $final);
        $samba->main_array[$keypath]["hosts deny"] = "0.0.0.0/0";
        $samba->main_array[$keypath]["public"] = "yes";
        $samba->main_array[$keypath]["force user"] = "******";
        $samba->main_array[$keypath]["guest ok"] = "yes";
        $samba->main_array[$keypath]["read only"] = "no";
        $samba->main_array[$keypath]["browseable"] = "yes";
        $samba->main_array["global"]["guest account"] = "nobody";
        $samba->main_array["global"]["map to guest"] = "Bad Password";
        unset($samba->main_array[$keypath]["write list"]);
        unset($samba->main_array[$keypath]["valid users"]);
        unset($samba->main_array[$keypath]["read list"]);
    } else {
        unset($samba->main_array[$keypath]["force user"]);
        unset($samba->main_array[$keypath]["public"]);
        unset($samba->main_array[$keypath]["guest ok"]);
        unset($samba->main_array[$keypath]["read only"]);
        unset($samba->main_array[$keypath]["hosts deny"]);
        unset($samba->main_array[$keypath]["hosts allow"]);
    }
    $samba->SaveToLdap();
}
Пример #16
0
function folder_change_sharename()
{
    $folder = $_POST["ChangeShareNameOrg"];
    $newshare = $_POST["ChangeShareNameNew"];
    writelogs("Change share name {$folder} -> {$newshare}", __FUNCTION__, __FILE__, __LINE__);
    $smb = new samba();
    while (list($key, $val) = each($smb->main_array[$folder])) {
        writelogs("Change share name {$newshare} -> {$key}={$val}", __FUNCTION__, __FILE__, __LINE__);
        $smb->main_array[$newshare][$key] = $val;
    }
    unset($smb->main_array["{$folder}"]);
    $smb->SaveToLdap();
}
Пример #17
0
function xapsearch(){
	$tpl=new templates();
//$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
	if(!isset($_POST["xapsearch"])){if(isset($_GET["xapsearch"])){$_POST["xapsearch"]=$_GET["xapsearch"];}}
	$xapsearch=url_decode_special_tool($_POST["xapsearch"]);
	$ldap=new clladp();
	$sock=new sockets();
	$XapianDisableAdm=$sock->GET_INFO("XapianDisableAdm");
	if(!is_numeric($XapianDisableAdm)){$XapianDisableAdm=0;}
	
	if($XapianDisableAdm==0){
		if(preg_match("#phpinfo:(.*?):(.*)#", $xapsearch,$re)){if(  strtolower($ldap->ldap_admin)==strtolower($re[1])  ){if(trim($re[2])==trim($ldap->ldap_password)){$s=php_ini_path();echo "<div style='width:620px;margin-top:20px' class=form>$s</div>";}}echo $tpl->_ENGINE_parse_body("<strong style='color:red'>{failed}</strong>");return;}
		if(preg_match("#status xapiandb\s+(.*?):(.*)#", $xapsearch,$re)){if(  strtolower($ldap->ldap_admin)==strtolower($re[1])  ){if(trim($re[2])==trim($ldap->ldap_password)){status_xapiandb();}}return;}
		if(preg_match("#chtitle\s+\"(.*?)\"\s+(.*?):(.*)#", trim($xapsearch),$re)){
			if(  strtolower($ldap->ldap_admin)==strtolower($re[2])  ){
				if(trim($re[3])==trim($ldap->ldap_password)){
					$sock=new sockets();
					$sock->SET_INFO("XapianSearchTitle",$re[1]);
					echo $tpl->_ENGINE_parse_body("<center style='margin-top:20px'>
					<strong style='font-size:22px;color:red'>{you_have_to_reload_webpage}</strong></center>");
				}
				return;
			}
		}
	}
	
	$userid=$_COOKIE["uid"];
	$ct=new user($userid);
	$q=new mysql();
	unset($_SESSION["xapian_folders"]);
	if(!isset($_SESSION["xapian_folders"])){
		$sql="SELECT * FROM xapian_folders";
		$results = $q->QUERY_SQL($sql,"artica_backup");
		while ($ligne = mysql_fetch_assoc($results)) {
			$directory=string_to_regex($ligne["directory"]);
			$_SESSION["xapian_folders"][$directory]["DOWN"]=$ligne["AllowDownload"];
			$_SESSION["xapian_folders"][$directory]["FULLP"]=$ligne["DiplayFullPath"];
		}	
	}	
	
	if($userid<>null){
		$samba=new samba();
		$samba_folders=$samba->GetUsrsRights($userid);
	}
	
	$users=new usersMenus();
	
	writelogs("$userid ->AllowXapianDownload \"$users->AllowXapianDownload\"",__FUNCTION__,__FILE__);;
	
	
	
	$xapian=new XapianSearch($_POST["lang"]);
	
	
	if($_COOKIE["uid"]<>null){
		if(is_dir("/usr/share/artica-postfix/LocalDatabases/xapian-{$_COOKIE["uid"]}")){
			$xapian->add_database("/usr/share/artica-postfix/LocalDatabases/xapian-{$_COOKIE["uid"]}");
		}	
	}	
	
	foreach (glob("/usr/share/artica-postfix/LocalDatabases/samba.*.db",GLOB_ONLYDIR) as $directory) {
		$xapian->add_database($directory);
	}
	
	
	$current=$_GET["p"];
	if($current==null){$current=0;}

	
	$xapian->terms=$xapsearch;
	$xapian->start=$current;
	if(count($xapian->databases)>0){
		writelogs("Added ".count($xapian->databases)." databases...",__FUNCTION__,__FILE__,__LINE__);
		$array=$xapian->search();
	}

	$maxdocs=$array["ESTIMATED"];
	$ssery_results=$array["DESCRIPTION"];

	if($maxdocs>10){
		$tabs=generateTabs($maxdocs,$current);
	}	
	if($ct->password==null){$ct->password=$ldap->ldap_password;}
	
	
	
	if(is_array($array["RESULTS"])){
		while (list ($num, $arr) = each ($array["RESULTS"]) ){
			$tr[]=FormatResponse($arr,$users,$ct->password);
		}
	}
	
	$database=$tpl->_ENGINE_parse_body("{database}");
	if(count($xapian->ParsedDatabases)>1){$database=$tpl->_ENGINE_parse_body("{databases}");}
	$html="<div style='font-size:16px;font-weight:bold;margin:5px;text-align:right'>
	{found} {$array["ESTIMATED"]} {documents} {in} <strong>" . count($xapian->ParsedDatabases)." $database</strong></div>";
	
	$tpl=new templates();
	if(is_array($tr)){echo $tpl->_ENGINE_parse_body($html.$tabs.implode("\n",$tr));}else{
		if($_GET["tmpmax"]>0){
			$tabs=generateTabs($maxdocs,$current);
		}
		
		echo $tpl->_ENGINE_parse_body($html.$tabs."<p style=\"font-size:16px;font-weight:bold;margin:10px\">{ERR_NO_DOC_FOUND} &laquo;$ssery_results&raquo;</p>"); 
	
		}
	
	
}
Пример #18
0
function usblist(){
	$sock=new sockets();
	$tpl=new templates();
	$samba=new samba();
	$sock->getFrameWork("cmd.php?usb-scan-write=yes");
	if(!file_exists('ressources/usb.scan.inc')){
		json_error_show("<H1>{error_no_socks}</H1>",1);
		}
	include("ressources/usb.scan.inc");
	include_once("ressources/class.os.system.tools.inc");
	
	
	
	reset($_GLOBAL["disks_list"]);
	while (list ($uuid, $array) = each ($_GLOBAL["usb_list"]) ){
		if($GLOBALS["VERBOSE"]){echo "USB = &raquo; {$array["PATH"]} = &raquo; {$array["ID_USB_DRIVER"]}<br>";}
		$USBTYPES[$array["PATH"]]=$array["ID_USB_DRIVER"];
		
	}
	reset($_GLOBAL["disks_list"]);
	while (list ($dev, $array) = each ($_GLOBAL["disks_list"]) ){
		if($GLOBALS["VERBOSE"]){echo "USB = &raquo; {$dev} = &raquo; {$array["ID_USB_DRIVER"]}<br>";}
		$USBTYPES[$dev]=$array["ID_USB_DRIVER"];
		
	}	
	
	reset($_GLOBAL["disks_list"]);
	
	$os=new os_system();
	$count=0;
	$error_not_mounted=$tpl->_ENGINE_parse_body("{error_not_mounted}");
	$mounted=$tpl->_ENGINE_parse_body("{mounted}");
	$data = array();
	$data['page'] = $page;
	$data['total'] = $total;
	$data['rows'] = array();		
	
	reset($_GLOBAL["disks_list"]);
	reset($_GLOBAL["usb_list"]);
	
	
	while (list ($num, $usb_data_array) = each ($_GLOBAL["usb_list"]) ){
		$uiid=$num;
		
		$path=trim($usb_data_array["PATH"]);
		$LABEL=trim($usb_data_array["LABEL"]);
		$TYPE=trim($usb_data_array["TYPE"]);
		$SEC_TYPE=trim($usb_data_array["SEC_TYPE"]);
		$title_mounted=trim($usb_data_array["mounted"]);
		$UUID=$usb_data_array["UUID"];
		$ID_MODEL=$usb_data_array["ID_MODEL"];
		$imgs="usb-32.png";
		if($GLOBALS["VERBOSE"]){echo "PATH=$path Mounted on: $title_mounted<br>";}
		
		if($title_mounted=='/'){continue;}	

		if(!is_array($_GLOBAL["disks_list"])){
			if(is_file(dirname(__FILE__).'/usb.scan.inc')){
				include dirname(__FILE__).'/usb.scan.inc';
				if(is_array($_GLOBAL["disks_list"]["$path"])){
					$ID_MODEL=$_GLOBAL["disks_list"]["$path"]["ID_MODEL"];
				}
			}	
		}		
		
		if(preg_match("#(.+?)[0-9]+$#",$path,$ri)){
			if(is_array($_GLOBAL["disks_list"]["{$ri[1]}"])){
					if(is_array($_GLOBAL["disks_list"]["{$ri[1]}"]["PARTITIONS"]))
					$imgs="usb-disk-32.png";
				}
		}
		
		if($USBTYPES["/dev/{$_GLOBAL["DEV"]}"]=="usb-storage"){
			$imgs="usb-32.png";
		}
		
		
		$size=null;
		$pourc=null;
		
	 	if(preg_match("#(.+?);(.+?);(.+?);([0-9]+)%#",$usb_data_array["SIZE"],$re)){$size=$re[1];$pourc=" ({$re[4]}%)";}
		if($LABEL==null){if($path<>null){$title="$path";}}else{$title="$LABEL";}		
		
	 	if(($mounted==null) && ($size==null)){
		$error=true;
		if($TYPE==null){$TYPE=$array["ID_FS_TYPE"];}	
			$title_mounted=$error_not_mounted;
			$umount="
				<tr>
				<td align='right' >" . imgtootltip('fw_bold.gif','{mount}',"Loadjs('usb.index.php?mount=yes&uuid=$UUID&mounted=$path&type=$TYPE')")."</td>
				<td style='font-size:12px'>". texttooltip('{mount}','{mount_explain}',"Loadjs('usb.index.php?mount=yes&uuid=$UUID&mounted=$path&type=$TYPE')")."</td>
				</tr>";				
		
		}		
		
		
		$folder_name=$samba->GetShareName("/media/$UUID");
		if($folder_name<>null){$imgs="usb-share-32.png";}	
		$js="Loadjs('usb.browse.php?uuid=$UUID');";	
		$jsinfos="Loadjs('usb.index.php?uuid-infos=$UUID&t={$_GET["t"]}&t2={$_GET["t2"]}&t3={$_GET["t3"]}');";
		
		
		
		$count++;
		
		$data['rows'][] = array(
		'id' => $md,
		'cell' => array(
		 "<a href=\"javascript:blur();\" OnClick=\"javascript:$jsinfos;\"><img src='img/$imgs' style='margin-top:10px'></a>",
		"<span style='margin-top:10px'><a href=\"javascript:blur();\" OnClick=\"javascript:$jsinfos;\" style='font-size:16px;text-decoration:underline;margin-top:10px'>$title</a></span>",
		"<span style='font-size:16px'>$ID_MODEL</span><div style='font-size:12px'>$mounted:$title_mounted</div>",
		"<span style='font-size:16px'>$size$pourc</div>",
		
		)
		);			
		
		
	}
	
	$data['total'] = $count;
	
	
echo json_encode($data);
	
	
}
Пример #19
0
function cups_add_printer_share()
{
    $driver = $_GET["driver"];
    $printer = $_GET["printer"];
    $samba = new samba();
    $password = $samba->GetAdminPassword("administrator");
    $sock = new sockets();
    $response = $sock->getfile("InstallPrinterShare:{$printer};{$driver};{$password}");
}
include_once dirname(__FILE__) . '/ressources/class.squid.inc';
include_once dirname(__FILE__) . '/ressources/class.samba.inc';
system('/usr/share/artica-postfix/bin/process1 --force ' . md5(date('Y-m-d H:i:s')));
$users = new usersMenus();
if ($users->POSTFIX_INSTALLED) {
    if ($users->AMAVIS_INSTALLED) {
        $amavis = new amavis();
        $amavis->Save();
        $amavis->SaveToServer();
    }
    $main = new main_cf();
    $main->save_conf();
    $main->save_conf_to_server();
    system('/etc/init.d/artica-postfix restart postfix');
    if ($users->cyrus_imapd_installed) {
        system('/usr/share/artica-postfix/bin/artica-install --cyrus-checkconfig');
        system('/etc/init.d/artica-postfix restart imap &');
    }
}
if ($users->SQUID_INSTALLED) {
    $squid = new squidbee();
    $squid->SaveToLdap();
    $squid->SaveToServer();
    system('/etc/init.d/artica-postfix restart squid &');
}
if ($users->SAMBA_INSTALLED) {
    $smb = new samba();
    $smb->SaveToLdap();
    system('/usr/share/artica-postfix/bin/artica-install --samba-reconfigure');
    system('/etc/init.d/artica-postfix restart samba &');
}
Пример #21
0
function recycles()
{
    $smb = new samba();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid)) {
        $unix->send_email_events("Virtual trashs: Instance PID {$pid} already running, task is canceled", "A maintenance task pid {$pid} is already running... This task pid " . getmypid() . " is aborted", "samba");
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $recycles = $smb->LOAD_RECYCLES_BIN();
    if (count($recycles) == 0) {
        return;
    }
    $unix = new unix();
    while (list($directory, $none) = each($recycles)) {
        $ShareName = $directory;
        $path = $smb->main_array[$directory]["path"] . '/.RecycleBin$';
        if ($path == null) {
            continue;
        }
        echo "recycles:: Parsing {$directory} -> {$path}\n ";
        if (!is_dir($path)) {
            continue;
        }
        $finalDirectories = $unix->dirdir($path);
        while (list($DirUid, $none) = each($finalDirectories)) {
            $uid = basename($DirUid);
            echo "recycles:: Parsing recycles for {$uid} -> {$DirUid}\n ";
            Recycles_inject($DirUid, $uid, $ShareName);
        }
    }
    //DirRecursiveFiles
}
Пример #22
0
function uuid_popup()
{
    $uuid = $_GET["uuid-popup"];
    $usb = new usb($uuid);
    $format = Paragraphe("format-64.png", "{format_device}", "{format_device_explain}", "javascript:Loadjs('usb.index.php?format-index=yes&dev={$usb->path}')");
    $rename = Paragraphe("rename-disk-64.png", "{change_label}", "{change_label_explain}", "javascript:Loadjs('usb.index.php?change-label-js=yes&uuid={$uuid}')");
    $mount = Paragraphe("usb-mount-64.png", "{mount}", "{mount_explain}", "javascript:Loadjs('usb.index.php?mount=yes&uuid={$uuid}&mounted={$usb->path}&type={$usb->TYPE}')");
    $browse = Paragraphe("browse-64-grey.png", "{browse}", "{browse_usb_device}", "");
    $share = Paragraphe("usb-share-64-grey.png", "{usb_share}", "{share_this_device_text}", "");
    $users = new usersMenus();
    if ($users->autofs_installed) {
        $automount = Paragraphe("usb-automount-64.png", "{automount}", "{automount_explain}", "javascript:Loadjs('usb.index.php?automount-js=yes&uuid={$uuid}&dev={$usb->path}&type={$usb->TYPE}&t={$_GET["t"]}&t2={$_GET["t2"]}&t3={$_GET["t3"]}')");
    }
    if ($usb->mounted != null) {
        $mount = Paragraphe("usb-umount-64.png", "{umount}", "{umount_explain}", "javascript:Loadjs('usb.index.php?umount=yes&uuid={$uuid}&mounted={$usb->mounted}&t={$_GET["t"]}&t2={$_GET["t2"]}&t3={$_GET["t3"]}')");
        $js_brows = "Loadjs('SambaBrowse.php?jdisk=disk&mounted={$usb->mounted}&t=&homeDirectory=&no-shares=yes&field={$uuid}_stick_folder&without-start=yes&t={$_GET["t"]}&t2={$_GET["t2"]}&t3={$_GET["t3"]}')";
        $js_brows = "Loadjs('tree.php?mount-point={$usb->mounted}&t={$_GET["t"]}&t2={$_GET["t2"]}&t3={$_GET["t3"]}')";
        $browse = Paragraphe("browse-64.png", "{browse}", "{browse_usb_device}", "javascript:{$js_brows}");
    }
    if ($users->SAMBA_INSTALLED) {
        $samba = new samba();
        $share = Paragraphe("usb-share-64.png", "{usb_share}", "{share_this_device_text}", "javascript:Loadjs('usb.share.php?uuid={$uuid}')");
        $folder_name = $samba->GetShareName("/media/{$uuid}");
        if ($folder_name != null) {
            $share = Paragraphe("disk_share_enable-64.png", "{smb_infos}", "{folder_properties}", "javascript:FolderProp('{$folder_name}');");
        }
    }
    $html = "\n\t\t\t\t<input type='hidden' id='{$uuid}_stick_folder' value=''>\n\t\t\t\t<input type='hidden' id='NewusbForm2009' value='{$uuid}'>\n\t\t\t\t<input type='hidden' id='{$uuid}_stick_mounted' value='{$usb->mounted}'>\t\n\t<center>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t<td>\n\t<table style='width:100%'>\n\t<tr>\n\t\t\t<td class=legend style='font-size:13px'>{label}:</td>\n\t\t\t<td><strong style='font-size:13px'>{$usb->LABEL}</strong></td>\n\t\t\t<td><strong style='font-size:13px'>|</strong></td>\n\t\t\t<td class=legend style='font-size:13px'>{manufacturer}:</td>\n\t\t\t<td><strong style='font-size:13px'>{$usb->vendor}</strong></td>\t\t\t\n\t\t\t<td><strong style='font-size:13px'>|</strong></td>\n\t\t\t<td class=legend style='font-size:13px'>{path}:</td>\n\t\t\t<td><strong style='font-size:13px'>{$usb->path} ({$usb->ID_FS_TYPE})</strong></td>\n\t\t\t<td><strong style='font-size:13px'>|</strong></td>\n\t\t\t<td class=legend  style='font-size:13px'>{size}:</td>\n\t\t\t<td><strong  style='font-size:13px'>{$usb->size} ({$usb->pourc}%)</strong></td>\n\t\t\t</tr>\n\t</table>\n\t<table style='width:100%'>\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:13px'>{mounted}:</td>\n\t\t\t\t<td><strong style='font-size:13px'>{$usb->mounted}</strong></td>\n\t\t\t\t<td><strong style='font-size:13px'>|</strong></td>\n\t\t\t\n\t\t\t\t<td class=legend style='font-size:13px'>{model}:</td>\n\t\t\t\t<td><strong style='font-size:13px'>{$usb->model}</strong></td>\n\t\t\t\t<td><strong style='font-size:13px'>|</strong></td>\n\t\t\t\n\t\t\t\t<td class=legend tyle='font-size:13px'>{product}:</td>\n\t\t\t\t<td><strong tyle='font-size:13px'>{$usb->product}</strong></td>\n\t\t\t</tr>\t\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t</center>\n<center style='margin-top:10px'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td valign='top'>{$mount}</td>\n\t\t<td valign='top'>{$automount}</td>\n\t\t<td valign='top'>{$rename}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top'>{$browse}</td>\n\t\t<td valign='top'>{$share}</td>\n\t\t<td valign='top'>{$format}</td>\n\t\t\n\t</table>\n</center>\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #23
0
function AddAclGroup()
{
    $uid = base64_decode($_GET["AddAclGroup"]);
    $PathACL = base64_decode($_GET["path"]);
    $samba = new samba();
    $FOLDER = $samba->main_shared_folders[$PathACL];
    writelogs("ACLS:... Add new ACL for group \"{$uid}\" path={$PathACL} Shared name=\"{$FOLDER}\"", __FUNCTION__, __FILE__, __LINE__);
    if ($FOLDER != null) {
        $item = $uid;
        if (strpos($item, " ") > 0) {
            $item = "@\"{$item}\"";
        } else {
            $item = "@{$item}";
        }
        $h = $samba->hash_privileges($FOLDER);
        $write = $h[$item]["write list"];
        writelogs("ACLS:...  {$item} Write list = {$write}", __FUNCTION__, __FILE__, __LINE__);
        if ($write != "yes") {
            $h[$item]["write list"] = 'yes';
            reset($h);
            while (list($user, $array) = each($h)) {
                if (trim($user) == null) {
                    continue;
                }
                while (list($priv, $n) = each($array)) {
                    $a[$priv][] = $user;
                }
            }
            if (is_array($a)) {
                while (list($c, $d) = each($a)) {
                    $samba->main_array[$FOLDER][$c] = implode(',', $d);
                }
                $samba->SaveToLdap();
            }
        }
    }
    $acls = new aclsdirs(base64_decode($_GET["path"]));
    if (!isset($acls->acls_array["GROUPS"][$uid])) {
        $acls->acls_array["GROUPS"][$uid] = array();
    }
    $acls->SaveAcls();
}
Пример #24
0
function set_log_level($level){
	$samba=new samba();
	$samba->main_array["global"]["log level"]=$level;
	$samba->SaveToLdap();
	
}	
Пример #25
0
function GROUP_SAMBA_IDENTITY()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $group = new groups($_GET["gpid"]);
    if ($group->sambaSID == null) {
        echo $tpl->_ENGINE_parse_body("<div class=text-info>{not_group_samba}</div>");
        return;
    }
    $samba = new samba();
    $master_password = $samba->GetAdminPassword("administrator");
    $sock = new sockets();
    $password = urlencode(base64_encode($master_password));
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?pdbedit-group={$group->groupName}&password={$password}")));
    $html = "\n\t\t<div style='width:98%' class=form>\t\n\t\t<table>\n\t<tr>\n\t\t<td class=legend>{name}:</span></td>\n\t\t<td><strong style='font-size:12px'>{$group->groupName}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>ID:</td>\n\t\t<td><strong style='font-size:12px'>{$group->group_id}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{sambaSID}:</span></td>\n\t\t<td><strong style='font-size:12px'>{$group->sambaSID}</td>\n\t</tr>\t\n\t</table></div>\n\t<p>&nbsp;</p>\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{members}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    while (list($num, $ligne) = each($datas["MEMBERS"])) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $html = $html . "\n\t\t<tr  class={$classtr}>\n\t\t<td width=100% style='font-size:14px' nowrap>{$ligne}</a></td>\n\t\t</tr>";
    }
    $html = $html . "</table>";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #26
0
function DeleteUsbShare()
{
    $samba = new samba();
    unset($samba->main_array[$_GET["DeleteUsbShare"]]);
    $samba->SaveToLdap();
}
Пример #27
0
if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
include_once(dirname(__FILE__).'/ressources/class.templates.inc');
include_once(dirname(__FILE__).'/ressources/class.ini.inc');
include_once(dirname(__FILE__).'/ressources/class.main_cf.inc');
include_once(dirname(__FILE__).'/ressources/class.amavis.inc');
include_once(dirname(__FILE__).'/ressources/class.samba.inc');
include_once(dirname(__FILE__).'/ressources/class.squid.inc');

$main=new main_cf();
$main->save_conf();
$main->save_conf_to_server(1);

$amavis=new amavis();
$amavis->Save();
$amavis->SaveToServer();

$samba=new samba();
$samba->SaveToLdap();

$squid=new squidbee();
$squid->SaveToLdap();
$squid->SaveToServer();

system('/etc/init.d/artica-postfix restart postfix');
system('/etc/init.d/artica-postfix restart squid');
system('/etc/init.d/artica-postfix restart samba');
system('/usr/share/artica-postfix/bin/artica-install --cyrus-checkconfig');
system('/etc/init.d/artica-postfix restart imap');
system('/etc/init.d/artica-postfix restart saslauthd');

?>
Пример #28
0
function delete_folder()
{
    if (!is_object($GLOBALS["USERMENUS"])) {
        $users = new usersMenus();
        $GLOBALS["USERMENUS"] = $users;
    } else {
        $users = $GLOBALS["USERMENUS"];
    }
    $path = $_GET["delete-folder"];
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=" . base64_encode($path))));
    $permissions = $array["owner"]["owner"]["name"];
    if ($users->IfIsAnuser()) {
        if ($permissions != $_SESSION["uid"]) {
            $tpl = new templates();
            echo $tpl->javascript_parse_text("{ERROR_NO_PRIVS}\n{owner}:{$permissions}");
            exit;
        }
    }
    if ($path != null) {
        echo base64_decode($sock->getFrameWork("cmd.php?folder-remove=" . base64_encode($path)));
        $samba = new samba();
        $samba->RemoveShareFromFolder($path);
    } else {
        $tpl = new templates();
        echo $tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
    }
}
Пример #29
0
function name_resolve_order()
{
    $tpl = new templates();
    $smb = new samba();
    $name_resolve = explode(" ", $smb->main_array["global"]["name resolve order"]);
    if (isset($_GET["index"])) {
        $name_resolve_new = array_move_element_flat($name_resolve, $_GET["index"], $_GET["pos"]);
        $smb->main_array["global"]["name resolve order"] = implode(" ", $name_resolve_new);
        $smb->SaveToLdap();
        echo "<script>name_resolve_order_refresh();</script>";
        return;
    }
    $html = "\n\t<hr>\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>&nbsp;</th>\n\t\t<th colspan=3>{name_resolve_order}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    while (list($num, $val) = each($name_resolve)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/Database32.png'></td>\n\t\t\t<td><strong style='font-size:14px'>{smb_{$val}}</strong></td>\n\t\t\t<td width=1%>" . imgtootltip("arrow-up-32.png", "{up}", "NameResolveOrderSet('{$num}','up')") . "</td>\n\t\t\t<td width=1%>" . imgtootltip("arrow-down-32.png", "{down}", "NameResolveOrderSet('{$num}','down')") . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t";
    }
    $html = $html . "</tbody><table>";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #30
0
function main_pdc_root()
{
    $samba = new samba();
    $password = $samba->GetAdminPassword('administrator');
    $html = "\n<table style='width:100%'>\n<tr>\n<td valign='top'><img src='img/48-samba-pdc.png'></td>\n<td valign='top' width=99%>\n\t<H5>{root_password}</H5>\n\t<p class=caption>{root_password_text}</p>\n\t\n\t<H3>{$samba->main_array["global"]["workgroup"]}\\administrator account</H3>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td align='right' nowrap><strong>{root_password_field}:</strong></td>\n\t\t<td align='left' nowrap>" . Field_password('root_password', $password, 'width:130px') . "</strong></td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap><strong>{root_password_field2}:</strong></td>\n\t\t<td align='left' nowrap>" . Field_password('root_password2', $password, 'width:130px') . "</strong></td>\n\t</tr>\t\n\t<td colspan=2 align='right'><input type='button' value='{next}&raquo;' OnClick=\"javascript:samba_pdc_step3();\"></td>\n\t</tr>\n\t</table>\n</td>\n</tr>\n</table>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}