Esempio n. 1
0
 function dbActionAdd()
 {
     $apppath = "/home/{$this->main->customer_name}/ror/{$this->main->getParentName()}/{$this->main->appname}/";
     $bpath = dirname($apppath);
     lxshell_directory($bpath, "rails", $this->main->appname);
     lxfile_unix_chown_rec($apppath, $this->main->__var_username);
 }
 static function readAuthorizedKey($username)
 {
     $p = os_get_home_dir($username);
     if ($p === '/tmp' && $username) {
         lxfile_mkdir("/home/{$username}");
         lxshell_return("usermod", "-d", "/home/{$username}", $username);
         lxfile_unix_chown_rec("/home/{$username}", "{$username}:{$username}");
         $p = "/home/{$username}";
     }
     if (!$p) {
         return;
     }
     $f = "{$p}/.ssh/authorized_keys";
     if (lxfile_exists("{$f}2")) {
         $s = lfile_get_contents("{$f}2");
         $s = "\n{$s}\n";
         lfile_put_contents($f, $s, FILE_APPEND);
         lunlink("{$f}2");
     }
     return lfile_get_contents($f);
 }
Esempio n. 3
0
 function createPhpInfo()
 {
     $domname = $this->nname;
     if (!lxfile_exists("__path_customer_root/{$this->username}/kloxoscript")) {
         lxfile_mkdir("__path_customer_root/{$this->username}/kloxoscript/");
         lxfile_cp("../file/script/phpinfo.phps", "__path_customer_root/{$this->username}/kloxoscript/phpinfo.php");
         lxfile_unix_chown_rec("__path_customer_root/{$this->username}/kloxoscript", "{$this->username}:{$this->username}");
     }
 }
Esempio n. 4
0
                    continue;
                }
                if ($drec->param === $oldip) {
                    $drec->param = $newip;
                }
            }
        }
        $dns->was();
    }
}
$list = lscandir_without_dot("/home/httpd");
foreach ($list as $l) {
    if (!is_dir("/home/httpd/{$l}")) {
        continue;
    }
    lxfile_unix_chown_rec("/home/httpd/{$l}/stats/", "apache");
}
$driverapp = $gbl->getSyncClass(null, 'localhost', 'web');
if ($driverapp === 'apache') {
    // --- issue #589
    //	addLineIfNotExistInside("/etc/httpd/conf/httpd.conf", "Include /etc/httpd/conf/kloxo/kloxo.conf", "");
    lxshell_return("__path_php_path", "../bin/misc/installsuphp.php");
} else {
    lxfile_cp("../file/lighttpd/lighttpd.conf", "/etc/lighttpd/lighttpd.conf");
    // --- issue #598
    //	lxfile_cp("../file/lighttpd/conf/kloxo/kloxo.conf", "/etc/lighttpd/conf/kloxo/kloxo.conf");
    //	lxfile_cp("../file/lighttpd/conf/kloxo/webmail.conf", "/etc/lighttpd/conf/kloxo/webmail.conf");
    lxfile_cp("../file/lighttpd/~lxcenter.conf", "/etc/lighttpd/conf.d/~lxcenter.conf");
    lxfile_cp("../file/lighttpd/conf/kloxo/webmail.conf", "/home/lighttpd/conf/defaults/webmail.conf");
    lxfile_mkdir("/home/kloxo/httpd/lighttpd");
    lxfile_unix_chown("/home/kloxo/httpd/lighttpd", "apache");
Esempio n. 5
0
 function do_restore($docd)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $name = $this->main->nname;
     $fullpath = "{$sgbl->__path_customer_root}/{$this->main->customer_name}/";
     $this->main->do_restore($docd);
     lxfile_unix_chown_rec($fullpath, $this->main->username);
 }
Esempio n. 6
0
function do_zip_to_fileserv($type, $arg)
{
    lxfile_mkdir("__path_serverfile/tmp");
    lxfile_unix_chown_rec("__path_serverfile", "lxlabs");
    $basebase = basename($arg[0]);
    $base = basename(ltempnam("__path_serverfile/tmp", $basebase));
    // Create the pass file now itself so that it isn't unwittingly created again.
    if ($type === 'zip') {
        $vd = $arg[0];
        $list = $arg[1];
        dprint("zipping {$vd}: " . implode(" ", $list) . " \n");
        $ret = lxshell_zip($vd, "__path_serverfile/tmp/{$base}.tmp", $list);
        lrename("__path_serverfile/tmp/{$base}.tmp", "__path_serverfile/tmp/{$base}");
    } else {
        if ($type === 'tgz') {
            $vd = $arg[0];
            $list = $arg[1];
            dprint("tarring {$vd}: " . implode(" ", $list) . " \n");
            $ret = lxshell_tgz($vd, "__path_serverfile/tmp/{$base}.tmp", $list);
            lrename("__path_serverfile/tmp/{$base}.tmp", "__path_serverfile/tmp/{$base}");
        } else {
            if ($type === 'tar') {
                $vd = $arg[0];
                $list = $arg[1];
                dprint("tarring {$vd}: " . implode(" ", $list) . " \n");
                $ret = lxshell_tar($vd, "__path_serverfile/tmp/{$base}.tmp", $list);
                lrename("__path_serverfile/tmp/{$base}.tmp", "__path_serverfile/tmp/{$base}");
            }
        }
    }
    if ($ret) {
        throw new lxException("could_not_zip_dir", '', $vd);
    }
    return "__path_serverfile/tmp/{$base}";
}
Esempio n. 7
0
function lxfile_generic_chown_rec($file, $mod)
{
    if (!$file) {
        return;
    }
    lxfile_unix_chown_rec($file, $mod);
}
Esempio n. 8
0
function os_fix_lxlabs_permission()
{
    global $gbl, $sgbl, $login, $ghtml;
    lxfile_mkdir("__path_program_root/session");
    lxfile_unix_chown_rec("__path_program_root", "lxlabs");
    lxfile_unix_chmod_rec("__path_program_root/sbin/", "0755");
    lxfile_unix_chmod_rec("__path_program_root/httpdocs/img/", "0755");
    lxfile_unix_chmod("__path_program_etc", "0700");
    lxfile_unix_chmod("__path_program_root/log", "0700");
    lxfile_unix_chmod("__path_program_root/session", "0700");
    // prevent php warning when file exist - already since 6.1.7
    if (!lxfile_exists("/usr/bin/lphp.exe")) {
        lxfile_symlink("__path_php_path", "/usr/bin/lphp.exe");
    }
}
Esempio n. 9
0
<?php

include_once "htmllib/lib/include.php";
initProgram('admin');
$list = posix_getpwnam('admin');
if (!$list) {
    os_create_system_user('admin', $login->password, 'admin', '/sbin/nologin', '/home/admin');
    lxfile_unix_chown_rec("/home/admin", "admin");
    //fixes issue #515
    lxfile_generic_chmod("/home/admin", "0770");
    lxshell_return("__path_php_path", "../bin/misc/fixwebdnsfullupdate.php");
    lxshell_return("__path_php_path", "../bin/misc/fixftpuserclient.phps");
}
Esempio n. 10
0
function os_fix_lxlabs_permission()
{
    global $gbl, $sgbl, $login, $ghtml;
    lxfile_mkdir("__path_program_root/session");
    lxfile_unix_chown_rec("__path_program_root", "lxlabs");
    lxfile_unix_chmod_rec("__path_program_root/sbin/", "0755");
    lxfile_unix_chmod_rec("__path_program_root/httpdocs/img/", "0755");
    lxfile_unix_chmod("__path_program_etc", "0700");
    lxfile_unix_chmod("__path_program_root/log", "0700");
    lxfile_unix_chmod("__path_program_root/session", "0700");
    lxfile_symlink("__path_php_path", "/usr/bin/lphp.exe");
}
Esempio n. 11
0
File: lib.php Progetto: zseand/kloxo
function fix_mailaccount_only()
{
    global $gbl, $sgbl, $login, $ghtml;
    log_cleanup("Fix mailaccount only");
    log_cleanup("- Fix process");
    lxfile_unix_chown_rec("/var/bogofilter", "lxpopuser:lxpopgroup");
    $login->loadAllObjects('mailaccount');
    $list = $login->getList('mailaccount');
    foreach ($list as $l) {
        $l->setUpdateSubaction('full_update');
        $l->was();
    }
}
Esempio n. 12
0
<?php

include_once "htmllib/lib/include.php";
initProgram('admin');
print "Fixing the admin\n";
$list = $login->getList('domain');
foreach ($list as $l) {
    $web = $l->getObject('web');
    $web->username = '******';
    $web->setUpdateSubaction('full_update');
    $web->was();
}
lxfile_unix_chown_rec("/home/admin/domain/", "admin:admin");
lxshell_return("lphp.exe", "../bin/misc/fixftpuserclient.phps");
Esempio n. 13
0
        exit;
    }
}
lxshell_return("service", "lxadmin", "stop");
lxshell_return("chkconfig", "lxadmin", "off");
lxfile_rm("/etc/init.d/lxadmin");
lxfile_mkdir("/usr/local/lxlabs/kloxo");
chdir("/usr/local/lxlabs/kloxo/");
lxfile_rm("kloxo-current.zip");
system("wget http://download.lxcenter.org/download/kloxo/production/kloxo/kloxo-current.zip");
system("unzip -oq kloxo-current.zip");
lxfile_rm_rec("/usr/local/lxlabs/kloxo/etc/");
lxfile_cp_rec("/usr/local/lxlabs/lxadmin/etc/", "/usr/local/lxlabs/kloxo/etc/");
if (!$sgbl->is_this_slave()) {
    system("service mysqld stop");
    if (!lxfile_exists("/var/lib/mysql/kloxo/")) {
        lxfile_cp_rec("/var/lib/mysql/lxadmin4_2", "/var/lib/mysql/kloxo");
    }
    lxfile_unix_chown_rec("/var/lib/mysql/kloxo", "mysql:mysql");
    system("service mysqld start");
    sleep(10);
    chdir("/usr/local/lxlabs/lxadmin/httpdocs/");
    passthru("lphp.exe ../bin/kloxo-db.php");
}
lxfile_cp("/usr/local/lxlabs/kloxo/httpdocs/htmllib/filecore/init.program", "/etc/init.d/kloxo");
lxfile_cp("/usr/local/lxlabs/lxadmin/etc/conf/lxadmin.pass", "/usr/local/lxlabs/kloxo/etc/conf/kloxo.pass");
lxfile_unix_chmod("/etc/init.d/kloxo", "0755");
lxshell_return("chkconfig", "kloxo", "on");
chdir("/usr/local/lxlabs/kloxo/httpdocs/");
passthru("lphp.exe ../bin/kloxo-migrate.php");
print "\n\n\nMigration to Kloxo Succesful. Please reboot the server for everything to take effect.\n\n";