本文整理汇总了PHP中unix::APACHE_GROUPWARE_ACCOUNT方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::APACHE_GROUPWARE_ACCOUNT方法的具体用法?PHP unix::APACHE_GROUPWARE_ACCOUNT怎么用?PHP unix::APACHE_GROUPWARE_ACCOUNT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::APACHE_GROUPWARE_ACCOUNT方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OCSWEB_PACKAGE_FRAGS
function OCSWEB_PACKAGE_FRAGS()
{
$sourcefile = base64_decode($_GET["filesource"]);
$unix = new unix();
$userwww = $unix->APACHE_GROUPWARE_ACCOUNT();
if (trim($sourcefile) == null) {
writelogs_framework("OCS-PACKAGES:: base64_decode({$_GET["filesource"]})=\"NULL\" aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
$FILEID = $_GET["FILEID"];
if (trim($FILEID) == null) {
writelogs_framework("OCS-PACKAGES:: FILEID=\"NULL\" aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
$nbfrags = $_GET["nbfrags"];
if (trim($nbfrags) == null) {
writelogs_framework("OCS-PACKAGES:: nbfrags=\"NULL\" aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
$TMP = $unix->FILE_TEMP();
shell_exec("/bin/cp {$sourcefile} {$TMP}");
$document_root = "/var/lib/ocsinventory-reports";
writelogs_framework("OCS-PACKAGES:: nbfrags=\"{$nbfrags}\"", __FUNCTION__, __FILE__, __LINE__);
writelogs_framework("OCS-PACKAGES:: SOURCE=\"{$sourcefile}\"", __FUNCTION__, __FILE__, __LINE__);
writelogs_framework("OCS-PACKAGES:: DEST=\"{$TMP}\"", __FUNCTION__, __FILE__, __LINE__);
@mkdir("{$document_root}/download/{$FILEID}", 0755, true);
@chmod("{$document_root}/download/{$FILEID}", 0755);
@chown("{$document_root}/download/{$FILEID}", $userwww);
$fname = $TMP;
if ($size = @filesize($fname)) {
writelogs_framework("OCS-PACKAGES:: SIZE=\"{$size}\"", __FUNCTION__, __FILE__, __LINE__);
$handle = fopen($fname, "rb");
$read = 0;
for ($i = 1; $i < $nbfrags; $i++) {
$contents = fread($handle, $size / $nbfrags);
$read += strlen($contents);
writelogs_framework("OCS-PACKAGES:: OPEN=\"{$document_root}/download/{$FILEID}/{$FILEID}-{$i}\"", __FUNCTION__, __FILE__, __LINE__);
$handfrag = fopen("{$document_root}/download/{$FILEID}/{$FILEID}-{$i}", "w+b");
fwrite($handfrag, $contents);
fclose($handfrag);
@chown("{$document_root}/download/{$FILEID}/{$FILEID}-{$i}", $userwww);
}
$contents = fread($handle, $size - $read);
$read += strlen($contents);
$handfrag = fopen("{$document_root}/download/{$FILEID}/{$FILEID}-{$i}", "w+b");
fwrite($handfrag, $contents);
fclose($handfrag);
fclose($handle);
@chown("{$document_root}/download/{$FILEID}/{$FILEID}-{$i}", $userwww);
unlink($TMP);
}
exec("/bin/chown -R {$userwww} {$document_root}/download/{$FILEID}", $results);
while (list($num, $ligne) = each($results)) {
writelogs_framework("OCS-PACKAGES:: chown: {$ligne}", __FUNCTION__, __FILE__, __LINE__);
}
}
示例2: CheckHomeFor
function CheckHomeFor($uid,$homeDirectory=null){
$ct=new user($uid);
if($homeDirectory==null){$homeDirectory=$ct->homeDirectory;}
echo "Starting......: Home $uid checking home: $homeDirectory\n";
if($GLOBALS["profile_path"]==null){
$sock=new sockets();
$profile_path=$sock->GET_INFO('SambaProfilePath');
$GLOBALS["profile_path"]=$profile_path;
}
if($ct->ou==null){writelogs("$uid: OU=NULL, No a standard user...SKIP",__FUNCTION__,__FILE__,__LINE__);return;}
$ou=$ct->ou;
$uid=strtolower($uid);
$newdir=trim(getStorageEnabled($ou,$uid));
if($newdir<>null){
$newdir="$newdir/$uid";
writelogs("LVM: [$ou]:: storage=$newdir;homeDirectory=$homeDirectory",__FUNCTION__,__FILE__,__LINE__);
if($newdir<>$homeDirectory){
writelogs("$uid:: change $homeDirectory to $newdir",__FUNCTION__,__FILE__,__LINE__);
$ct->homeDirectory=$newdir;
$ct->edit_system();
$homeDirectory=$newdir;
}
}
if($homeDirectory==null){
$homeDirectory="/home/$uid";
writelogs("$uid:: change $homeDirectory",__FUNCTION__,__FILE__,__LINE__);
$ct->homeDirectory=$homeDirectory;
$ct->edit_system();
}
if($GLOBALS["profile_path"]<>null){
$export="$profile_path/$uid";
writelogs("Checking export:$export",__FUNCTION__,__FILE__,__LINE__);
@mkdir($export);
@chmod($export,0775);
@chown($export,$uid);
}
writelogs("Checking home:$homeDirectory",__FUNCTION__,__FILE__,__LINE__);
@mkdir($homeDirectory);
@chmod($homeDirectory,0775);
@chown($homeDirectory,$uid);
if($ct->WebDavUser==1){
$unix=new unix();
$find=$unix->find_program("find");
$apacheuser=$unix->APACHE_GROUPWARE_ACCOUNT();
if(preg_match("#(.+?):#",$apacheuser,$re)){$apacheuser=$re[1];}
$internet_folder="$homeDirectory/Internet Folder";
@mkdir($internet_folder);
@chmod($internet_folder,0775);
$internet_folder=$unix->shellEscapeChars($internet_folder);
echo "Starting......: Home $uid checking home: $internet_folder\n";
writelogs("Checking $ct->uid:$apacheuser :$internet_folder",__FUNCTION__,__FILE__,__LINE__);
shell_exec("/bin/chown -R $ct->uid:$apacheuser $internet_folder >/dev/null 2>&1 &");
shell_exec("$find $internet_folder -type d -exec chmod 755 {} \; >/dev/null 2>&1 &");
}
}
示例3: GROUPOFFICE_INSTALL
function GROUPOFFICE_INSTALL($servername, $root, $hash = array())
{
$srcfolder = "/usr/local/share/artica/group-office";
$GLOBALS["ADDLOG"] = "{$GLOBALS["ARTICALOGDIR"]}/{$servername}.log";
$sql_file = "/usr/share/artica-postfix/bin/install/opengoo/group-office.sql";
$sql_datas = "/usr/share/artica-postfix/bin/install/opengoo/group-office-datas.sql";
if ($root == null) {
events("Starting install GroupOffice Unable to stat root dir");
return false;
}
if (!is_dir($srcfolder)) {
events("Starting install GroupOffice Unable to stat SRC");
return false;
}
$user = $hash["wwwmysqluser"][0];
$mysql_password = $hash[strtolower("WWWMysqlPassword")][0];
$appli_user = $hash["wwwappliuser"][0];
$appli_password = $hash["wwwapplipassword"][0];
$wwwsslmode = $hash["wwwsslmode"][0];
$ou = $hash["OU"][0];
$server_database = str_replace(".", "_", $servername);
$server_database = str_replace(" ", "_", $server_database);
$server_database = str_replace("-", "_", $server_database);
events("Starting install GroupOffice sub-system mysql database {$server_database}...");
if ($user == null) {
events("Starting install GroupOffice Unable to stat Mysql username");
return false;
}
if ($mysql_password == null) {
events("Starting install GroupOffice Unable to stat Mysql password");
return false;
}
@mkdir($root, 0755, true);
events("Starting install GroupOffice sub-system mysql database {$server_database}...");
$q = new mysql();
if (!$q->DATABASE_EXISTS($server_database)) {
$q->CREATE_DATABASE($server_database);
}
if (!$q->DATABASE_EXISTS($server_database)) {
events("Starting install GroupOffice unable to create MYSQL Database");
return false;
}
events("Starting setting permissions on Database with user {$user}");
$q->PRIVILEGES($user, $mysql_password, $server_database);
if (!GROUPOFFICE_TEST_FILES($root)) {
events("Starting install GroupOffice installing source code");
shell_exec("/bin/cp -rf {$srcfolder}/* {$root}/");
@mkdir("/home/groupoffice/{$servername}", 0777, true);
}
@mkdir("/home/groupoffice/{$servername}", 0777, true);
$unix = new unix();
$apacheuser = $unix->APACHE_GROUPWARE_ACCOUNT();
events("chown /home/groupoffice has {$apacheuser}");
shell_exec("/bin/chown -R {$apacheuser} /home/groupoffice");
if ($q->mysql_password != null) {
$password = " --password={$q->mysql_password} ";
} else {
events("Starting install GroupOffice installing tables datas with null password");
}
$cmd = "mysql --port={$q->mysql_port} --skip-column-names --database={$server_database} --silent --xml ";
$cmd = $cmd . " --user={$q->mysql_admin}{$password} <{$sql_file}";
shell_exec($cmd);
$sock = new sockets();
$ApacheGroupWarePort = $sock->GET_INFO("ApacheGroupWarePort");
events("Starting install opengo SSL={$wwwsslmode}");
if ($wwwsslmode == "TRUE") {
$ROOT_URL = "https://{$servername}";
} else {
$ROOT_URL = "http://{$servername}:{$ApacheGroupWarePort}";
}
$q = new mysql();
$conf[] = "<?php";
$conf[] = "\$config['enabled']=true;";
$conf[] = "\$config['id']=\"groupoffice\";";
$conf[] = "\$config['debug']=false;";
$conf[] = "\$config['log']=false;";
$conf[] = "\$config['language']=\"en\";";
$conf[] = "\$config['default_country']=\"FR\";";
$conf[] = "\$config['default_timezone']=\"Europe/Amsterdam\";";
$conf[] = "\$config['default_currency']=\"€\";";
$conf[] = "\$config['default_date_format']=\"dmY\";";
$conf[] = "\$config['default_date_separator']=\"-\";";
$conf[] = "\$config['default_time_format']=\"G:i\";";
$conf[] = "\$config['default_first_weekday']=\"1\";";
$conf[] = "\$config['default_decimal_separator']=\",\";";
$conf[] = "\$config['default_thousands_separator']=\".\";";
$conf[] = "\$config['theme']=\"Default\";";
$conf[] = "\$config['allow_themes']=true;";
$conf[] = "\$config['allow_password_change']=false;";
$conf[] = "\$config['allow_profile_edit']=true;";
$conf[] = "\$config['allow_registration']=false;";
$conf[] = "\$config['registration_fields']=\"title_initials,sex,birthday,address,home_phone,fax,cellular,company,department,function,work_address,work_phone,work_fax,homepage\";";
$conf[] = "\$config['required_registration_fields']=\"company,address\";";
$conf[] = "\$config['allow_duplicate_email']=false;";
$conf[] = "\$config['auto_activate_accounts']=false;";
$conf[] = "\$config['notify_admin_of_registration']=true;";
$conf[] = "\$config['register_modules_read']=\"summary,email,calendar,tasks,addressbook,files,notes,links,tools,comments\";";
$conf[] = "\$config['register_modules_write']=\"\";";
$conf[] = "\$config['allowed_modules']=\"\";";
$conf[] = "\$config['register_user_groups']=\"\";";
//.........这里部分代码省略.........
示例4: vhosts_users_ou
function vhosts_users_ou($array)
{
$unix = new unix();
$ldap = new clladp();
$sock = new sockets();
$ApacheGroupWarePort = $sock->GET_INFO("ApacheGroupWarePort");
$SSLStrictSNIVHostCheck = $sock->GET_INFO("SSLStrictSNIVHostCheck");
$ou = $array["OU"][0];
$apacheservername = trim($array["apacheservername"][0]);
$wwwservertype = trim($array["wwwservertype"][0]);
$wwwsslmode = $array["wwwsslmode"][0];
$root = $array["apachedocumentroot"][0];
$index_cgi = $unix->BACKUPPC_GET_CGIBIN_PATH();
$img_dir = $unix->BACKUPPC_GET_IMG_DIR();
if ($index_cgi == null) {
echo "Starting Apache..............: BackupPC Unable to stat index.cgi\n";
return;
}
if ($img_dir == null) {
echo "Starting Apache..............: BackupPC Unable to images path\n";
return;
}
@mkdir($root, 0755, true);
shell_exec("/bin/cp {$index_cgi} {$root}/index.cgi");
shell_exec("/bin/ln -s {$img_dir} {$root}/image >/dev/null 2>&1");
shell_exec("chmod 4755 {$root}/index.cgi");
patchIndex($root);
$apacheuser = $unix->APACHE_GROUPWARE_ACCOUNT();
if (preg_match("#(.+?):#", $apacheuser, $re)) {
$apacheuser = $re[1];
}
shell_exec("chown -R backuppc:{$apacheuser} {$root}");
system("chmod 4755 {$root}/index.cgi");
$ApacheGroupWarePort_WRITE = $ApacheGroupWarePort;
echo "Starting Apache..............: BackupPC checking host {$apacheservername} in {$root} for {$apacheuser}:backuppc\n";
if ($wwwsslmode == "TRUE") {
$ssl[] = "\tSSLEngine on";
$ssl[] = "\tSSLCertificateFile {$GLOBALS["SSLKEY_PATH"]}/{$apacheservername}.crt";
$ssl[] = "\tSSLCertificateKeyFile {$GLOBALS["SSLKEY_PATH"]}/{$apacheservername}.key";
$unix->vhosts_BuildCertificate($apacheservername);
$ApacheGroupWarePort_WRITE = "443";
$SSLMODE = true;
$conf[] = "\n<VirtualHost *:{$ApacheGroupWarePort}>";
$conf[] = "\tServerName {$apacheservername}";
$conf[] = "\tRedirect / https://{$apacheservername}";
$conf[] = "</VirtualHost>\n";
}
echo "Starting Apache..............: BackupPC \"{$apacheservername}:{$ApacheGroupWarePort_WRITE}\"\n";
$conf[] = "\n<VirtualHost *:{$ApacheGroupWarePort_WRITE}>";
$conf[] = "\tServerName {$apacheservername}";
//$conf[]="\tSuexecUserGroup backuppc backuppc";
$conf[] = "\tServerAdmin webmaster@{$apacheservername}";
$conf[] = "\tDocumentRoot {$root}";
$conf[] = @implode("\n", $ssl);
include_once dirname(__FILE__) . "/ressources/class.freeweb.inc";
$freeweb = new freeweb();
$conf[] = $freeweb->WebDavBrowserMatches();
$conf[] = "\tAlias /backuppc {$root}";
$conf[] = "\t<Directory \"{$root}\">";
$conf[] = "\tAllowOverride None";
$conf[] = "\tAllow from all";
$conf[] = "\tOptions ExecCGI FollowSymlinks";
$conf[] = "\tAddHandler cgi-script .cgi";
$conf[] = "\tDirectoryIndex index.cgi";
$conf[] = "\t\tAuthType Basic";
$conf[] = "\t\tAuthBasicProvider ldap";
$conf[] = "\t\tAuthzLDAPAuthoritative off";
$conf[] = "\t\tAuthUserFile /dev/null";
$conf[] = "\t\tAuthLDAPBindDN \"cn={$ldap->ldap_admin},{$ldap->suffix}\"";
$conf[] = "\t\tAuthLDAPBindPassword {$ldap->ldap_password}";
$conf[] = "\t\tAuthLDAPUrl ldap://{$ldap->ldap_host}:{$ldap->ldap_port}/ou={$ou},dc=organizations,{$ldap->suffix}?uid";
$conf[] = "\t\tAuthName \"Authorization required\"";
$conf[] = "\t\trequire ldap-filter &(uid=*)";
$conf[] = "\t\trequire valid-user";
$conf[] = "\t</Directory>";
$conf[] = "</VirtualHost>\n";
return @implode("\n", $conf);
}