function dbactionUpdate($subaction)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $dir = $this->main->__var_full_directory;
     $dir = expand_real_root($dir);
     switch ($subaction) {
         case "full_update":
             $pass = $this->main->realpass;
             lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "passwd", $this->main->nname, "-m");
             lxshell_return("pure-pw", "usermod", $this->main->nname, "-d", $dir, "-m");
             $this->toggleStatus();
             $this->setQuota();
             break;
         case "password":
             $pass = $this->main->realpass;
             lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "passwd", $this->main->nname, "-m");
             break;
         case "toggle_status":
             $this->toggleStatus();
             break;
         case "edit":
             lxshell_return("pure-pw", "usermod", $this->main->nname, "-d", $dir, "-m");
             $this->setQuota();
             break;
         case "changeowner":
             lxshell_return("pure-pw", "usermod", $this->main->nname, "-u", $this->main->__var_username, "-d", $dir, "-m");
             break;
     }
 }
 function do_restore($docd)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $dbadmin = $this->main->__var_dbadmin;
     $dbpass = $this->main->__var_dbpassword;
     $vd = tempnam("/tmp", "mysqldump");
     lunlink($vd);
     mkdir($vd);
     $docf = "{$vd}/mysql-{$this->main->dbname}.dump";
     $ret = lxshell_unzip_with_throw($vd, $docd);
     if (!lxfile_exists($docf)) {
         throw new lxException('could_not_find_matching_dumpfile_for_db', '', '');
     }
     $cont = lfile_get_contents($docf);
     if ($this->main->dbpassword) {
         $ret = lxshell_input($cont, "__path_mysqlclient_path", "-u", $this->main->username, "-p{$this->main->dbpassword}", $this->main->dbname);
     } else {
         $ret = lxshell_input($cont, "__path_mysqlclient_path", "-u", $this->main->username, $this->main->dbname);
     }
     if ($ret) {
         log_restore("Mysql restore failed.... Copying the mysqldump file {$docf} to {$sgbl->__path_kloxo_httpd_root}...");
         lxfile_cp($docf, "__path_kloxo_httpd_root");
         throw new lxException('mysql_error_could_not_restore_data', '', '');
     }
     lunlink($docf);
     lxfile_tmp_rm_rec($vd);
 }
Example #3
0
<?php

include_once "htmllib/lib/include.php";
initProgram('admin');
$sq = new Sqlite(null, 'ftpuser');
$list = $sq->getRowsWhere("realpass = ''");
if (!$list) {
    exit;
}
foreach ($list as $l) {
    if ($l['realpass']) {
        continue;
    }
    print "setting pass for {$l['nname']}\n";
    $name = $l['nname'];
    $pass = randomString(8);
    $sq->rawQuery("update ftpuser set realpass = '******' where nname = '{$name}'");
    lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "passwd", $name, "-m");
}