コード例 #1
0
function FixQuotaDovecot($conditions)
{
    global $db;
    $db2 = new DB_System();
    $query = "SELECT mailbox.id,concat(path, '/Maildir/') as dir \n            FROM \n              mailbox \n              join address on address.id = mailbox.address_id \n              join domaines on domaines.id = address.domain_id\n              {$conditions} ;";
    if (!$db->query($query)) {
        usage("failed");
        // FIXME real error
        exit(1);
    }
    while ($db->next_record()) {
        $dir = $db->f("dir");
        $id = $db->f("id");
        $size = exec("/usr/bin/du -sb {$dir}|cut -f1");
        // FIXME check return value
        if (!$db2->query("UPDATE mailbox set bytes=" . intval($size) . " where id=" . intval($id) . ";")) {
            echo "Fail updating quota for mailbox : {$id}\n";
        }
    }
}
コード例 #2
0
ファイル: m_admin.php プロジェクト: GuillaumeFromage/AlternC
 /** Deletes an account
  * Deletes the specified account. Prevents any manipulation of the account if
  * the account $mid is not super-admin.
  * 
  * @global    m_err   $err
  * @global    m_quota $quota
  * @global    array   $classes
  * @global    int     $cuid
  * @global    m_mem   $mem
  * @global    m_dom   $dom
  * @global    m_hooks $hooks
  * @global    m_action $action
  * @param     int     $uid    The uid number of the account 
  * @return    boolean         Returns FALSE if an error occurs, TRUE if not.
  */
 function del_mem($uid)
 {
     global $err, $quota, $classes, $cuid, $mem, $dom, $hooks, $action;
     $err->log("admin", "del_mem", $uid);
     if (!$this->enabled) {
         $err->raise("admin", _("-- Only administrators can access this page! --"));
         return false;
     }
     $db = new DB_System();
     $tt = $this->get($uid);
     $mem->su($uid);
     // This script may take a long time on big accounts, let's give us some time ... Fixes 1132
     @set_time_limit(0);
     // WE MUST call m_dom before all others because of conflicts ...
     $dom->hook_admin_del_member();
     # New way of deleting or backup delted user html folders using action class
     $path = getuserpath($tt['login']);
     $action->archive($path);
     $hooks->invoke("alternc_del_member");
     $hooks->invoke("hook_admin_del_member");
     if ($db->query("DELETE FROM membres WHERE uid='{$uid}';") && $db->query("DELETE FROM local WHERE uid='{$uid}';")) {
         $mem->unsu();
         // If this user was (one day) an administrator one, he may have a list of his own accounts. Let's associate those accounts to nobody as a creator.
         $db->query("UPDATE membres SET creator=2000 WHERE creator='{$uid}';");
         return true;
     } else {
         $err->raise("admin", _("Account not found"));
         $mem->unsu();
         return false;
     }
 }
コード例 #3
0
ファイル: 3.0.1.php プロジェクト: GuillaumeFromage/AlternC
}
// If we upgrade directly to 3.1 the panel directory change
$panel = '';
if (chdir("/usr/share/alternc/panel")) {
    $panel = '/usr/share/alternc/panel';
} elseif (chdir("/var/alternc/bureau")) {
    $panel = '/var/alternc/bureau';
}
if (empty($panel)) {
    echo "Problem to load panel library";
    exit(1);
}
require "{$panel}/class/config_nochk.php";
$db2 = new DB_System();
// we go super-admin
$admin->enabled = 1;
$db->query("select distinct uid,login,pass from db;");
//on insere dans dbusers avec enabled = admin
$query = array();
while ($db->next_record()) {
    $db2->query("select id from dbusers where name ='" . $db->f('login') . "' and password='******'pass') . "';");
    if ($db2->num_rows() == 0) {
        $query[] = "insert ignore into dbusers values(''," . $db->f('uid') . ",'" . $db->f('login') . "','" . $db->f('pass') . "',\"ADMIN\");";
    }
}
foreach ($query as $q) {
    $db->query($q);
}
?>
//done ? :)
コード例 #4
0
ファイル: m_aws.php プロジェクト: GuillaumeFromage/AlternC
 /** 
  * This function is called on each class when a domain name is uninstalled
  * @param string $dom the domain to uninstall
  */
 function alternc_del_domain($dom)
 {
     global $err, $cuid;
     $err->log("aws", "alternc_del_domain", $dom);
     $db = new DB_System();
     $db->query("SELECT id,hostname FROM aws WHERE uid='{$cuid}' AND (hostname='{$dom}' OR hostname like '%.{$dom}')");
     $t = array();
     while ($db->next_record()) {
         $t[] = array($db->f("hostname"), $db->f("id"));
     }
     foreach ($t as $i) {
         $db->query("DELETE FROM aws WHERE uid='{$cuid}' AND hostname='" . $i[0] . "';");
         $db->query("DELETE FROM aws_access WHERE uid='{$cuid}' AND id='" . $i[1] . "';");
         $this->_delconf($i[0]);
     }
     return $this->_createhtpasswd();
 }