function syncSpamUserPref() { global $gbl, $sgbl, $ghtml; // The parent can be either a domain or a user. CHeck for the @ sign. if (csa($this->main->nname, "@")) { list($user, $domain) = explode("@", $this->main->nname); } else { $domain = $this->main->nname; $user = null; } // --- issue #578/#721 - missing in version 6.1.6 // $mailpath = "/home/lxadmin/mail"; $mailpath = mmail__qmail::getDir($domain); if ($user) { // $prefpath = "$mailpath/domains/{$domain}/{$user}/user_prefs"; $prefpath = "{$mailpath}/{$user}/user_prefs"; } else { return; } if (!lxfile_exists(dirname($prefpath))) { lxfile_mkdir(dirname($prefpath)); lxfile_generic_chown(dirname($prefpath), "lxpopuser:lxpopgroup"); } $fdata = null; $fdata .= "required_score " . $this->main->spam_hit . "\n"; $fdata .= "ok_locales all\n"; $fdata .= "rewrite_header Subject {$this->main->subject_tag}\n"; foreach ((array) $this->main->wlist_a as $wlist) { $fdata .= "whitelist_from " . $wlist->nname . "\n"; } $fdata .= "#***********************************\n"; foreach ((array) $this->main->blist_a as $blist) { $fdata .= "blocklist_from " . $blist->nname . "\n"; } lxfile_rm($prefpath); lfile_write_content($prefpath, $fdata, "lxpopuser:lxpopgroup"); }
function createHtpasswordFile($object, $sdir, $list) { $dir = "__path_httpd_root/{$object->main->getParentName()}/{$sdir}/"; $loc = $object->main->directory; $file = get_file_from_path($loc); $dirfile = "{$dir}/{$file}"; if (!lxfile_exists($dir)) { lxfile_mkdir($dir); lxfile_unix_chown($dir, $object->main->__var_username); } $fstr = null; foreach ($list as $k => $p) { $cr = crypt($p); $fstr .= "{$k}:{$cr}\n"; } dprint($fstr); lfile_write_content($dirfile, $fstr, $object->main->__var_username); lxfile_unix_chmod($dirfile, "0755"); }
function dbactionUpdate($subaction) { global $gbl, $sgbl, $login, $ghtml; if_demo_throw_exception('ffile'); $this->aux = new Ffile__common(null, null, $this->nname); $this->aux->main = $this->main; if ($this->main->isOn('readonly')) { throw new lxexception('file_manager_is_readonly', ''); } $chownug = "{$this->main->__username_o}:{$this->main->__username_o}"; switch ($subaction) { case "fancyedit": case "edit": check_file_if_owned_by_and_throw($this->main->getFullPath(), $this->main->__username_o); lfile_write_content($this->main->getFullPath(), $this->main->content, $chownug); lxshell_return("dos2unix", $this->main->getFullPath()); lxfile_unix_chmod($this->main->getFullPath(), "0644"); break; case "upload_s": $filename = $this->aux->uploadDirect(); lxfile_unix_chown($filename, "{$this->main->__username_o}:{$this->main->__username_o}"); lxfile_unix_chmod($filename, "0644"); break; case "rename": $this->aux->reName(); //lxfile_unix_chown($new, $this->main->__username_o); break; case "paste": $this->aux->filePaste(); break; case "perm": $arg = null; $perm = $this->main->newperm; $perm = 0 . $perm; if ($this->main->isOn('recursive_f')) { new_process_chmod_rec($this->main->__username_o, $this->main->fullpath, $perm); } else { lxfile_unix_chmod($this->main->fullpath, "{$perm}"); } break; case "newdir": $path = $this->aux->newDir(); lxfile_unix_chown($path, $this->main->__username_o); lxfile_unix_chown($path, $chownug); break; case "content": if ($this->main->is_image()) { $this->aux->resizeImage(); } else { throw new lxexception('cannot_save_content', ''); } break; case "thumbnail": $this->aux->createThumbnail(); break; case "convert_image": $this->aux->convertImage(); break; case "zip_file": $zipfile = $this->aux->zipFile(); lxfile_unix_chown($zipfile, $this->main->__username_o); lxfile_unix_chown($zipfile, $chownug); break; case "filedelete": $this->aux->moveAllToTrash(); break; case "filerealdelete": $this->aux->fileRealDelete(); break; case "restore_trash": $this->aux->restoreTrash(); break; case "clear_trash": $this->aux->clearTrash(); break; case "download_from_http": $fullpath = $this->aux->downloadFromHttp(); lxfile_unix_chown($fullpath, $this->main->__username_o); break; case "download_from_ftp": $fullpath = $this->aux->downloadFromFtp(); lxfile_unix_chown($fullpath, $this->main->__username_o); break; case "zipextract": $dir = $this->aux->zipExtract(); if ($sgbl->isKloxo() && $this->main->__username_o !== 'root') { //lxfile_unix_chown_rec($dir, "{$this->main->__username_o}"); //lxfile_unix_chown_rec($dir, $chownug); } break; } }