~josephjamesmills/zpanelcp/zpanelcp

« back to all changes in this revision

Viewing changes to debian/zpanelx/etc/zpanel/modules/ftp_management/hooks/proftpd-mysql.php

  • Committer: Joseph Mills
  • Date: 2012-05-09 02:52:32 UTC
  • Revision ID: josephjamesmills@gmail.com-20120509025232-ob5xni0ggrse28c0
setup framwork for www

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
/**
4
 
 *
5
 
 * ZPanel - A Cross-Platform Open-Source Web Hosting Control panel.
6
 
 * 
7
 
 * @package ZPanel
8
 
 * @version $Id$
9
 
 * @author Bobby Allen - ballen@zpanelcp.com
10
 
 * @copyright (c) 2008-2011 ZPanel Group - http://www.zpanelcp.com/
11
 
 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License v3
12
 
 *
13
 
 * This program (ZPanel) is free software: you can redistribute it and/or modify
14
 
 * it under the terms of the GNU General Public License as published by
15
 
 * the Free Software Foundation, either version 3 of the License, or
16
 
 * (at your option) any later version.
17
 
 *
18
 
 * This program is distributed in the hope that it will be useful,
19
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 
 * GNU General Public License for more details.
22
 
 *
23
 
 * You should have received a copy of the GNU General Public License
24
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 
 *
26
 
 */
27
 
 
28
 
                $result = $zdbh->query("SELECT * FROM x_settings WHERE so_name_vc='ftp_db'")->Fetch();
29
 
                $ftp_db = $result['so_value_tx'];
30
 
                include('cnf/db.php');
31
 
                $z_db_user = $user;
32
 
                $z_db_pass = $pass;
33
 
                try {   
34
 
                        $ftp_db = new db_driver("mysql:host=localhost;dbname=$ftp_db", $z_db_user, $z_db_pass);
35
 
                } catch (PDOException $e) {
36
 
                
37
 
                }
38
 
                
39
 
                foreach ($deletedclients as $deletedclient){    
40
 
                        $sql = "SELECT COUNT(*) FROM x_ftpaccounts WHERE ft_acc_fk=" . $deletedclient . " AND ft_deleted_ts IS NULL";
41
 
                    if ($numrows = $zdbh->query($sql)) {
42
 
                        if ($numrows->fetchColumn() <> 0) {
43
 
                                $sql = $zdbh->prepare("SELECT * FROM x_ftpaccounts WHERE ft_acc_fk=" . $deletedclient . " AND ft_deleted_ts IS NULL");
44
 
                            $sql->execute();
45
 
                            while ($rowclient = $sql->fetch()) {                
46
 
                                                $fsql = $ftp_db->prepare("DELETE FROM ftpquotalimits 
47
 
                                                                                                 WHERE
48
 
                                                                                                 name='".$rowclient['ft_user_vc']."'");
49
 
                                                $fsql->execute();
50
 
                                                $fsql = $ftp_db->prepare("DELETE FROM ftpuser 
51
 
                                                                                                 WHERE
52
 
                                                                                                 userid='".$rowclient['ft_user_vc']."'");
53
 
                                                $fsql->execute();                               
54
 
                           }
55
 
                                $sql = $zdbh->prepare("UPDATE x_ftpaccounts SET ft_deleted_ts=" . time() . " WHERE ft_acc_fk=".$deletedclient."");
56
 
                $sql->execute();
57
 
                        }
58
 
                        }
59
 
                }
60
 
?>
 
 
b'\\ No newline at end of file'