コード例 #1
0
 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;
     }
     $sysuser = mmail__qmail::getUserGroup($domain);
     // --- 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}/.bogopref.cf";
         $prefpath = "{$mailpath}/{$user}/.bogopref.cf";
     } else {
         return;
     }
     $prefdir = dirname($prefpath);
     if (!lxfile_exists(dirname($prefpath))) {
         lxuser_mkdir($sysuser, dirname($prefpath));
     }
     $wname = fix_nname_to_be_variable($this->main->nname);
     $fdata = null;
     $cutoff = $this->main->spam_hit / 10 + 0.2;
     $fdata .= "spam_cutoff  {$cutoff}\n";
     $fdata .= "spam_subject_tag={$this->main->subject_tag}\n";
     $fdata .= "wordlist R,user,{$wname}.wordlist.db,1\n";
     $fdata .= "wordlist R,system,wordlist.db,2\n";
     $fdata .= "wordlist R,system,kloxo.wordlist.db,3\n";
     lxuser_put_contents($sysuser, $prefpath, $fdata);
     if (!lxfile_real("/var/bogofilter/{$wname}.wordlist.db")) {
         new_process_cmd($sysuser, null, "bogofilter -d /var/bogofilter/ --wordlist=R,user,{$wname}.wordlist.db,1  -n < /etc/my.cnf");
     }
     lxfile_touch("/var/bogofilter/wordlist.db");
     // Using generic because spamassasin is used on windows too. Or at least can be used.
     //lxfile_generic_chown("/var/bogofilter", mmail__qmail::getUserGroup($domain));
 }
コード例 #2
0
ファイル: ffile__commonlib.php プロジェクト: soar-team/kloxo
 function zipFile()
 {
     foreach ($this->main->zip_file_list as &$_t_f) {
         $_t_f = coreFfile::removeLeadingSlash($_t_f);
         $_t_f = basename($_t_f);
         $_t_f = "\"{$_t_f}\"";
     }
     $list = implode(" ", $this->main->zip_file_list);
     $oldir = getcwd();
     $fullpath = expand_real_root($this->main->fullpath);
     /*
     $fz = $fullpath . "/" . $this->main->zip_file_f;
     if (lxfile_exists($fz)) {
     	throw new lxexception('file_exists', 'zip_file_f', $this->main->zip_file_f);
     }
     */
     $date = date("M-d-H");
     //check_file_if_owned_by_and_throw("NewArchive-$date.zip", $this->main->__username_o);
     $ret = new_process_cmd($this->main->__username_o, $fullpath, "zip -qu -r NewArchive-{$date} {$list}");
     return "{$fullpath}/NewArchive-{$date}.zip";
 }
コード例 #3
0
ファイル: commonfslib.php プロジェクト: hypervm-ng/hypervm-ng
function lxshell_user_return($username, $cmd)
{
    global $sgbl;
    $start = 2;
    $arglist = array();
    $nargs = @func_num_args();
    if ($nargs > 0) {
        for ($i = $start; $i < $nargs; $i++) {
            $arglist[] = isset($transforming_func) ? $transforming_func(func_get_arg($i)) : func_get_arg($i);
        }
    }
    $cmd = getShellCommand($cmd, $arglist);
    $ret = new_process_cmd($username, null, $cmd);
    return $ret;
}
コード例 #4
0
ファイル: commonfslib.php プロジェクト: zseand/kloxo
/**
 * Executes an external program or command as given user 
 * 
 * @param $username
 * @param $cmd command to execute
 * @return depends on executed command
 */
function lxuser_return($username, $cmd)
{
    global $sgbl;
    $start = 2;
    eval($sgbl->arg_getting_string);
    $cmd = getShellCommand($cmd, $arglist);
    $ret = new_process_cmd($username, null, $cmd);
    return $ret;
}
コード例 #5
0
ファイル: linuxfslib.php プロジェクト: zseand/kloxo
function lxshell_unzip($username, $dir, $file, $filelist = null)
{
    $dir = expand_real_root($dir);
    $file = expand_real_root($file);
    $files = null;
    if ($filelist) {
        foreach ($filelist as &$__nf) {
            $__nf = "'{$__nf}'";
        }
        $files = implode(" ", $filelist);
    }
    if ($file[0] !== '/') {
        $fullpath = getcwd() . "/{$file}";
    } else {
        $fullpath = $file;
    }
    $ztype = os_getZipType($fullpath);
    if ($ztype === 'tgz') {
        $command = "tar -xzf";
    } else {
        if ($ztype === 'tar') {
            $command = "tar -xf";
        } else {
            $command = "unzip -oq";
        }
    }
    $fcmd = "{$command} {$fullpath} {$files}";
    $fcmd = str_replace(";", "", $fcmd);
    $ret = new_process_cmd($username, $dir, "nice -n 15 {$fcmd}");
    return $ret;
}
コード例 #6
0
ファイル: lxlib.php プロジェクト: zseand/kloxo
function new_process_cp_rec($user, $src, $dst)
{
    $src = expand_real_root($src);
    $dst = expand_real_root($dst);
    $cmd = "cp -a '{$src}' '{$dst}'";
    new_process_cmd($user, null, $cmd);
}
コード例 #7
0
ファイル: commonfslib.php プロジェクト: soar-team/kloxo
/**
 * Executes an external program or command as given user 
 * 
 * @param string $username
 * @param string $cmd command to execute
 * @return string depends on executed command
 */
function lxuser_return($username, $cmd)
{
    global $sgbl;
    $start = 2;
    $arglist = array();
    for ($i = $start; $i < func_num_args(); $i++) {
        if (isset($transforming_func)) {
            $arglist[] = $transforming_func(func_get_arg($i));
        } else {
            $arglist[] = func_get_arg($i);
        }
    }
    $cmd = getShellCommand($cmd, $arglist);
    $ret = new_process_cmd($username, null, $cmd);
    return $ret;
}