function GenerateVisitorStats()
{
    include 'cnf/db.php';
    $z_db_user = $user;
    $z_db_pass = $pass;
    try {
        $zdbh = new db_driver("mysql:host=localhost;dbname=" . $dbname . "", $z_db_user, $z_db_pass);
    } catch (PDOException $e) {
    }
    $sql = $zdbh->prepare("SELECT * FROM x_vhosts LEFT JOIN x_accounts ON x_vhosts.vh_acc_fk=x_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL");
    $sql->execute();
    echo "Generating visitor stats html..." . fs_filehandler::NewLine();
    while ($rowvhost = $sql->fetch()) {
        if (!file_exists(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "")) {
            @mkdir(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "", 777, TRUE);
        }
        if (sys_versions::ShowOSPlatformVersion() == "Windows") {
            $runcommand = ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors.exe -A -m 30 " . ctrl_options::GetOption('log_dir') . "domains/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . "-access.log -o html > " . ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . ".html";
        } else {
            chmod(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors", 4777);
            $runcommand = ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors -A -m 30 " . ctrl_options::GetOption('log_dir') . "domains/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . "-access.log -o html > " . ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . ".html";
        }
        echo "Generating stats for: " . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . fs_filehandler::NewLine();
        system($runcommand);
    }
}
function CalculateAllDatabaseSize()
{
    global $zdbh;
    include 'cnf/db.php';
    $z_db_user = $user;
    $z_db_pass = $pass;
    $mysqlsql = $zdbh->query("SELECT my_id_pk, my_name_vc FROM x_mysql_databases WHERE my_deleted_ts IS NULL");
    while ($database = $mysqlsql->fetch()) {
        $currentdb = new db_driver("mysql:host={$host};dbname=" . $database['my_name_vc'] . "", $z_db_user, $z_db_pass);
        $currentdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $dbsize = $currentdb->query("SHOW TABLE STATUS");
        $dbgetsize = 0;
        while ($row = $dbsize->fetch()) {
            $dbgetsize = $dbgetsize + ($row['Data_length'] + $row['Index_length']);
        }
        //$zdbh->query("UPDATE x_mysql_databases SET my_usedspace_bi = '" . $dbgetsize . "' WHERE my_id_pk =" . $database['my_id_pk'] . "");
        $numrows = $zdbh->prepare("UPDATE x_mysql_databases SET my_usedspace_bi = :dbgetsize WHERE my_id_pk =:my_id_pk");
        $numrows->bindParam(':dbgetsize', $dbgetsize);
        $numrows->bindParam(':my_id_pk', $database['my_id_pk']);
        $numrows->execute();
        //echo "Database found: " . $database['my_name_vc'] . " - " . $dbgetsize . " \n";
    }
}
Example #3
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
// Deleting hMail Mailboxes
if (!fs_director::CheckForEmptyValue(self::$delete)) {
    //  $result = $mail_db->query("SELECT accountid FROM hm_accounts WHERE accountaddress=:mb_address_vc")->Fetch();
    $numrows = $mail_db->prepare("SELECT accountid FROM hm_accounts WHERE accountaddress=:mb_address_vc");
    $numrows->bindParam(':mb_address_vc', $rowmailbox['mb_address_vc']);
    $numrows->execute();
    $result = $numrows->fetch();
    if ($result) {
        $sql = $mail_db->prepare("DELETE FROM hm_accounts WHERE accountaddress=:mb_address_vc");
        $sql->bindParam(':mb_address_vc', $rowmailbox['mb_address_vc']);
        $sql->execute();
    }
}
Example #4
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
// Deleting hMail Alias
if (!fs_director::CheckForEmptyValue(self::$delete)) {
    //$result = $mail_db->query("SELECT aliasname FROM hm_aliases WHERE aliasname='" . $rowalias['al_address_vc'] . "'")->Fetch();
    $bindArray = NULL;
    $bindArray = array(':aliasname' => $rowalias['al_address_vc']);
    $sqlStatment = $mail_db->bindQuery("SELECT aliasname FROM hm_aliases WHERE aliasname=:aliasname", $bindArray);
    $result = $mail_db->returnRow();
    if ($result) {
        $sqlStatment = "DELETE FROM hm_aliases WHERE aliasname=:aliasname";
        $sql = $mail_db->prepare($sqlStatment);
        $sql->bindParam(':aliasname', $rowalias['al_address_vc']);
        $sql->execute();
    }
Example #5
0
 * @copyright 2014-2015 Sentora Project (http://www.sentora.org/) 
 * Sentora is a GPL fork of the ZPanel Project whose original header follows:
 *
 * Initiates the database driver object and debug object and registers the $zdhb and $zlo globals for the framework.
 * @package zpanelx
 * @subpackage core
 * @author Bobby Allen (ballen@bobbyallen.me)
 * @copyright ZPanel Project (http://www.zpanelcp.com/)
 * @link http://www.zpanelcp.com/
 * @license GPL (http://www.gnu.org/licenses/gpl.html)
 */
/**
 * @global debug_logger $zlo
 */
global $zlo;
/**
 * @global db_driver $zdbh
 */
global $zdbh;
$zlo = new debug_logger();
try {
    $zdbh = new db_driver("mysql:host={$host};dbname={$dbname}", $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));
    $zdbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    $zlo->method = "text";
    $zlo->logcode = "0100";
    $zlo->detail = "Unable to connect or authenticate against the database supplied!";
    $zlo->mextra = $e;
    $error_html = "<style type=\"text/css\"><!--\n            .dbwarning {\n                    font-family: Verdana, Geneva, sans-serif;\n                    font-size: 14px;\n                    color: #C00;\n                    background-color: #FCC;\n                    padding: 30px;\n                    border: 1px solid #C00;\n            }\n            p {\n                    font-size: 12px;\n                    color: #666;\n            }\n            </style>\n            <div class=\"dbwarning\"><strong>Critical Error:</strong> [0100] - Unable to connect or authenticate to the Sentora database (<em>{$dbname}</em>).<p>We advice that you contact the server administrator to ensure that the database server is online and that the correct connection parameters are being used.</p></div>";
    die($error_html);
}
Example #6
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
foreach ($deletedclients as $deletedclient) {
    $sql = "SELECT * FROM x_distlists WHERE dl_acc_fk=:deletedclient AND dl_deleted_ts IS NULL";
    //$numrows = $zdbh->query($sql);
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':deletedclient', $deletedclient);
    $numrows->execute();
    if ($numrows->fetchColumn() != 0) {
        $sql = $zdbh->prepare($sql);
        $sql->bindParam(':deletedclient', $deletedclient);
        $sql->execute();
        while ($rowmailbox = $sql->fetch()) {
            //distlist
            //$result = $mail_db->query("SELECT address FROM alias WHERE address='" . $rowmailbox['dl_address_vc'] . "'")->Fetch();
Example #7
0
function ExecuteBackup($userid, $username, $download = 0)
{
    include '../../../cnf/db.php';
    try {
        $zdbh = new db_driver("mysql:host=" . $host . ";dbname=" . $dbname . "", $user, $pass);
    } catch (PDOException $e) {
        exit;
    }
    $basedir = ctrl_options::GetSystemOption('temp_dir');
    if (!is_dir($basedir)) {
        fs_director::CreateDirectory($basedir);
    }
    $basedir = ctrl_options::GetSystemOption('sentora_root') . "etc/tmp/";
    if (!is_dir($basedir)) {
        fs_director::CreateDirectory($basedir);
    }
    $temp_dir = ctrl_options::GetSystemOption('sentora_root') . "etc/tmp/";
    // Lets grab and archive the user's web data....
    $homedir = ctrl_options::GetSystemOption('hosted_dir') . $username;
    $backupname = $username . "_" . date("M-d-Y_hms", time());
    $dbstamp = date("dmy_Gi", time());
    // We now see what the OS is before we work out what compression command to use..
    if (sys_versions::ShowOSPlatformVersion() == "Windows") {
        $resault = exec(fs_director::SlashesToWin(ctrl_options::GetSystemOption('zip_exe') . " a -tzip -y-r " . $temp_dir . $backupname . ".zip " . $homedir . "/public_html"));
    } else {
        //cd /var/sentora/hostdata/zadmin/; zip -r backups/backup.zip public_html/
        $resault = exec("cd " . $homedir . "/ && " . ctrl_options::GetSystemOption('zip_exe') . " -r9 " . $temp_dir . $backupname . " public_html/*");
        @chmod($temp_dir . $backupname . ".zip", 0777);
    }
    // Now lets backup all MySQL datbases for the user and add them to the archive...
    $sql = "SELECT COUNT(*) FROM x_mysql_databases WHERE my_acc_fk=:userid AND my_deleted_ts IS NULL";
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':userid', $userid);
    $numrows->execute();
    if ($numrows) {
        if ($numrows->fetchColumn() != 0) {
            $sql = $zdbh->prepare("SELECT * FROM x_mysql_databases WHERE my_acc_fk=:userid AND my_deleted_ts IS NULL");
            $sql->bindParam(':userid', $userid);
            $sql->execute();
            while ($row_mysql = $sql->fetch()) {
                $bkcommand = ctrl_options::GetSystemOption('mysqldump_exe') . " -h " . $host . " -u " . $user . " -p" . $pass . " --no-create-db " . $row_mysql['my_name_vc'] . " > " . $temp_dir . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql";
                passthru($bkcommand);
                // Add it to the ZIP archive...
                if (sys_versions::ShowOSPlatformVersion() == "Windows") {
                    $resault = exec(fs_director::SlashesToWin(ctrl_options::GetSystemOption('zip_exe') . " u " . $temp_dir . $backupname . ".zip " . $temp_dir . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql"));
                } else {
                    $resault = exec("cd " . $temp_dir . "/ && " . ctrl_options::GetSystemOption('zip_exe') . " " . $temp_dir . $backupname . "  " . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql");
                }
                unlink($temp_dir . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql");
            }
        }
    }
    // We have the backup now lets output it to disk or download
    if (file_exists($temp_dir . $backupname . ".zip")) {
        // If Disk based backups are allowed in backup config
        if (strtolower(ctrl_options::GetSystemOption('disk_bu')) == "true") {
            // Copy Backup to user home directory...
            $backupdir = $homedir . "/backups/";
            if (!is_dir($backupdir)) {
                fs_director::CreateDirectory($backupdir);
                @chmod($backupdir, 0777);
            }
            copy($temp_dir . $backupname . ".zip", $backupdir . $backupname . ".zip");
            fs_director::SetFileSystemPermissions($backupdir . $backupname . ".zip", 0777);
        } else {
            $backupdir = $temp_dir;
        }
        // If Client has checked to download file
        if ($download != 0) {
            /* Ajax not supporting headers - changed to link in temp dir.
                          if (sys_versions::ShowOSPlatformVersion() == "Windows") {
                          # Now we send the output (Windows)...
                          header('Pragma: public');
                          header('Expires: 0');
                          header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                          header('Cache-Control: private', false);
                          header('Content-Type: application/zip');
                          header('Content-Disposition: attachment; filename=' . $backupname . '.zip');
                          header('Content-Transfer-Encoding: binary');
                          header('Content-Length: ' . filesize($backupdir . $backupname . '.zip ') . '');
                          readfile($backupdir . $backupname . ".zip ");
                          } else {
            
                          # Now we send the output (POSIX)...
                          $file = $backupdir . $backupname . ".zip";
                          header('Pragma: public');
                          header('Expires: 0');
                          header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                          header('Cache-Control: private', false);
                          header('Content-Description: File Transfer');
                          header('Content-Transfer-Encoding: binary');
                          header('Content-Type: application/force-download');
                          header('Content-Length: ' . filesize($file));
                          header('Content-Disposition: attachment; filename=' . $backupname . '.zip');
                          readfile_chunked($file);
                          }
                         */
            fs_director::SetFileSystemPermissions($backupdir . $backupname . ".zip", 0777);
            return $temp_dir . $backupname . ".zip";
        }
        unlink($temp_dir . $backupname . ".zip");
    } else {
        echo "File not found in temp directory!";
        return FALSE;
    }
    return TRUE;
}
Example #8
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$result = $zdbh->query("SELECT * FROM x_settings WHERE so_name_vc='ftp_db'")->Fetch();
$ftp_db = $result['so_value_tx'];
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $ftp_db = new db_driver("mysql:host=" . $host . ";dbname={$ftp_db}", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
foreach ($deletedclients as $deletedclient) {
    $sql = "SELECT COUNT(*) FROM x_ftpaccounts WHERE ft_acc_fk=:deletedclient AND ft_deleted_ts IS NULL";
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':deletedclient', $deletedclient);
    if ($numrows->execute()) {
        if ($numrows->fetchColumn() != 0) {
            $sql = $zdbh->prepare("SELECT * FROM x_ftpaccounts WHERE ft_acc_fk=:deletedclient AND ft_deleted_ts IS NULL");
            $sql->bindParam(':deletedclient', $deletedclient);
            $sql->execute();
            while ($rowclient = $sql->fetch()) {
                $fsql = $ftp_db->prepare("DELETE FROM ftpquotalimits \n\t\t\t\t\t\t\t\t\t\t\t\t WHERE\n\t\t\t\t\t\t\t\t\t\t\t\t name=:ft_user_vc");
                $fsql->bindParam(':ft_user_vc', $rowclient['ft_user_vc']);
                $fsql->execute();
<?php

include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
$z_db_host = $host;
$z_db_name = $dbname;
try {
    $zdbh = new db_driver("mysql:host=" . $z_db_host . ";dbname=" . $z_db_name . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
echo fs_filehandler::NewLine() . "START Backup Config." . fs_filehandler::NewLine();
if (ui_module::CheckModuleEnabled('Backup Config')) {
    echo "Backup Config module ENABLED..." . fs_filehandler::NewLine();
    // Schedule daily backups are enabled...
    if (strtolower(ctrl_options::GetSystemOption('schedule_bu')) == "true") {
        runtime_hook::Execute('OnBeforeScheduleBackup');
        echo "Backup Scheduling enabled - Backing up all enabled client files now..." . fs_filehandler::NewLine();
        // Get all accounts
        $bsql = "SELECT * FROM x_accounts WHERE ac_enabled_in=1 AND ac_deleted_ts IS NULL";
        $numrows = $zdbh->query($bsql);
        if ($numrows->fetchColumn() != 0) {
            $bsql = $zdbh->prepare($bsql);
            $bsql->execute();
            while ($rowclients = $bsql->fetch()) {
                echo "Backing up client folder: " . $rowclients['ac_user_vc'] . "/public_html..." . fs_filehandler::NewLine();
                // User loop
                $username = $rowclients['ac_user_vc'];
                $userid = $rowclients['ac_id_pk'];
                $homedir = ctrl_options::GetSystemOption('hosted_dir') . $username;
                //$backupname = $username . "_" . date("M-d-Y_hms", time());
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
foreach ($deletedclients as $deletedclient) {
    $sql = "SELECT * FROM x_forwarders WHERE fw_acc_fk=:deletedclient AND fw_deleted_ts IS NULL";
    //  $numrows = $zdbh->query($sql);
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':deletedclient', $deletedclient);
    $numrows->execute();
    if ($numrows->fetchColumn() != 0) {
        $sql = $zdbh->prepare($sql);
        $sql->bindParam(':deletedclient', $deletedclient);
        $sql->execute();
        while ($rowforwarder = $sql->fetch()) {
            //$result = $mail_db->query("SELECT address FROM alias WHERE address='" . $rowforwarder['fw_address_vc'] . "'")->Fetch();
            $numrows = $zdbh->prepare("SELECT address FROM alias WHERE address=:fw_address_vc");
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
// Deleting Postfix Alias
if (!fs_director::CheckForEmptyValue(self::$delete)) {
    //$result = $mail_db->query("SELECT address FROM alias WHERE address='" . $rowalias['al_address_vc'] . "'")->Fetch();
    $bindArray = NULL;
    $bindArray = array(':aliasname' => $rowalias['al_address_vc']);
    $sqlStatment = $mail_db->bindQuery("SELECT address FROM alias WHERE address=:aliasname", $bindArray);
    $result = $mail_db->returnRow();
    if ($result) {
        $sqlStatment = "DELETE FROM alias WHERE address=:address";
        $sql = $mail_db->prepare($sqlStatment);
        $sql->bindParam(':address', $rowalias['al_address_vc']);
        $sql->execute();
    }
Example #12
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$ftp_db = ctrl_options::GetSystemOption('ftp_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $ftp_db = new db_driver("mysql:host=" . $host . ";dbname={$ftp_db}", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
// Included after acount has been created
if (!fs_director::CheckForEmptyValue(self::$create)) {
    $homedir = ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'] . $homedirectory_to_use . "";
    $sql = $ftp_db->prepare("INSERT INTO ftpquotalimits (name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail) VALUES (:username, 'user', 'true', 'hard', 0, 0, 0, 0, 0, 0);");
    $sql->bindParam(':username', $username);
    $sql->execute();
    $sql = $ftp_db->prepare("INSERT INTO ftpuser (id, userid, passwd, homedir, shell, count, accessed, modified) VALUES ('', :username, :password, :homedir, '/sbin/nologin', 0, '', '');");
    $sql->bindParam(':username', $username);
    $sql->bindParam(':password', $password);
    $sql->bindParam(':homedir', $homedir);
    $sql->execute();
}
// Included after account is created
Example #13
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
// Adding hMail DistList
if (!fs_director::CheckForEmptyValue(self::$create)) {
    //$result = $mail_db->query("SELECT domainid FROM hm_domains WHERE domainname='" . $inDomain . "'")->Fetch();
    $numrows = $mail_db->prepare("SELECT domainid FROM hm_domains WHERE domainname=:inDomain");
    $numrows->bindParam(':inDomain', $inDomain);
    $numrows->execute();
    $result = $numrows->fetch();
    if ($result) {
        $domain_id = $result['domainid'];
        $sql = "INSERT INTO hm_distributionlists (\n\t\t    \t\t\t\t\t\tdistributionlistdomainid,\n\t\t\t\t\t\t\t\t\tdistributionlistaddress,\n\t\t\t\t\t\t\t\t\tdistributionlistenabled,\n\t\t\t\t\t\t\t\t\tdistributionlistrequireauth,\n\t\t\t\t\t\t\t\t\tdistributionlistrequireaddress,\n\t\t\t\t\t\t\t\t\tdistributionlistmode) VALUES (\n\t\t\t\t\t\t\t\t\t :domain_id,\n\t\t\t\t\t\t\t\t\t :fulladdress,\n\t\t\t\t\t\t\t\t\t 1,\n\t\t\t\t\t\t\t\t\t 0,\n\t\t\t\t\t\t\t\t\t '',\n\t\t\t\t\t\t\t\t\t 0)";
        $sql = $mail_db->prepare($sql);
        $sql->bindParam(':domain_id', $domain_id);
        $sql->bindParam(':fulladdress', $fulladdress);
Example #14
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
foreach ($deletedclients as $deletedclient) {
    $sql = "SELECT * FROM x_mailboxes WHERE mb_acc_fk=:deletedclient AND mb_deleted_ts IS NULL";
    //$numrows = $zdbh->query($sql);
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':deletedclient', $deletedclient);
    $numrows->execute();
    if ($numrows->fetchColumn() != 0) {
        $sql = $zdbh->prepare($sql);
        $sql->bindParam(':deletedclient', $deletedclient);
        $sql->execute();
        while ($rowmailbox = $sql->fetch()) {
            // Deleting PostFix Mailboxes
            $msql = $mail_db->prepare("DELETE FROM mailbox WHERE username=:mb_address_vc");
Example #15
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
foreach ($deletedclients as $deletedclient) {
    $sql = "SELECT * FROM x_distlists WHERE dl_acc_fk=:deletedclient AND dl_deleted_ts IS NULL";
    //$numrows = $zdbh->query($sql);
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':deletedclient', $deletedclient);
    $numrows->execute();
    if ($numrows->fetchColumn() != 0) {
        $sql = $zdbh->prepare($sql);
        $sql->bindParam(':deletedclient', $deletedclient);
        $sql->execute();
        while ($rowmailbox = $sql->fetch()) {
            //distlist
            //$result = $mail_db->query("SELECT distributionlistid FROM hm_distributionlists WHERE distributionlistaddress='" . $rowmailbox['dl_address_vc'] . "'")->Fetch();
Example #16
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
foreach ($deletedclients as $deletedclient) {
    $sql = "SELECT * FROM x_aliases WHERE al_acc_fk=:acc AND al_deleted_ts IS NULL";
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':acc', $deletedclient);
    $numrows->execute();
    if ($numrows->fetchColumn() != 0) {
        $sql = $zdbh->prepare($sql);
        $sql->execute();
        while ($rowmailbox = $sql->fetch()) {
            $bindArray = array(':aliasname' => $rowmailbox['al_address_vc']);
            $sqlStatment = $zdbh->bindQuery("SELECT aliasname FROM hm_aliases WHERE aliasname=:aliasname", $bindArray);
            $result = $zdbh->returnRow();
            if ($result) {
Example #17
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
// Deleting hMail Forwarder
if (!fs_director::CheckForEmptyValue(self::$delete)) {
    //$result = $mail_db->query("SELECT accountaddress FROM hm_accounts WHERE accountaddress='" . $rowforwarder['fw_address_vc'] . "'")->Fetch();
    $numrows = $mail_db->prepare("SELECT accountaddress FROM hm_accounts WHERE accountaddress=:fw_address_vc");
    $numrows->bindParam(':fw_address_vc', $rowforwarder['fw_address_vc']);
    $numrows->execute();
    $result = $numrows->fetch();
    if ($result) {
        $sql = "UPDATE hm_accounts SET accountforwardenabled='0', accountforwardaddress='', accountforwardkeeporiginal='0' WHERE accountaddress=:fw_address_vc";
        $sql = $mail_db->prepare($sql);
        $sql->bindParam(':fw_address_vc', $rowforwarder['fw_address_vc']);
        $sql->execute();
    }
Example #18
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
foreach ($deletedclients as $deletedclient) {
    $sql = "SELECT * FROM x_mailboxes WHERE mb_acc_fk=:deletedclient AND mb_deleted_ts IS NULL";
    //$numrows = $zdbh->query($sql);
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':deletedclient', $deletedclient);
    $numrows->execute();
    if ($numrows->fetchColumn() != 0) {
        $sql = $zdbh->prepare($sql);
        $sql->bindParam(':deletedclient', $deletedclient);
        $sql->execute();
        while ($rowmailbox = $sql->fetch()) {
            //$result = $mail_db->query("SELECT accountid FROM hm_accounts WHERE accountaddress='" . $rowmailbox['mb_address_vc'] . "'")->Fetch();
            $numrows = $mail_db->prepare("SELECT accountid FROM hm_accounts WHERE accountaddress=:mb_address_vc");
Example #19
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
// Deleting Postfix Distubution List
if (!fs_director::CheckForEmptyValue(self::$delete)) {
    //$result = $mail_db->query("SELECT address FROM alias WHERE address='" . $rowdl['dl_address_vc'] . "'")->Fetch();
    $numrows = $mail_db->prepare("SELECT address FROM alias WHERE address=:dl_address_vc");
    $numrows->bindParam(':dl_address_vc', $rowdl['dl_address_vc']);
    $numrows->execute();
    $result = $numrows->fetch();
    if ($result) {
        $sql = "DELETE FROM alias WHERE address=:dl_address_vc";
        $sql = $mail_db->prepare($sql);
        $sql->bindParam(':dl_address_vc', $rowdl['dl_address_vc']);
        $sql->execute();
    }
Example #20
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$mailserver_db = ctrl_options::GetSystemOption('mailserver_db');
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
    $mail_db = new db_driver("mysql:host=" . $host . ";dbname=" . $mailserver_db . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
    echo $e;
}
// Adding PostFix Mailboxes
if (!fs_director::CheckForEmptyValue(self::$create)) {
    //$result = $mail_db->query("SELECT domain FROM domain WHERE domain='" . $domain . "'")->Fetch();
    $numrows = $mail_db->prepare("SELECT domain FROM domain WHERE domain=:domain");
    $numrows->bindParam(':domain', $domain);
    $numrows->execute();
    $result = $numrows->fetch();
    if (!$result) {
        $sql = $mail_db->prepare("INSERT INTO domain (  domain,\n                                                        description,\n                                                        aliases,\n                                                        mailboxes,\n                                                        maxquota,\n                                                        quota,\n                                                        transport,\n                                                        backupmx,\n                                                        created,\n                                                        modified,\n                                                        active) VALUES (\n                                                        :domain,\n                                                        '',\n                                                        0,\n                                                        0,\n                                                        0,\n                                                        0,\n                                                        '',\n                                                        0,\n                                                        NOW(),\n                                                        NOW(),\n                                                        '1')");
        $sql->bindParam(':domain', $domain);
        $sql->execute();
    }