ftimme
2011-10-11 81d79a79e4b29e9314b64b2e4c49b48ae8319767
- WebDAV Users: show only domains that run on Apache (because nginx does not have full WebDAV support).
2 files modified
32 ■■■■ changed files
interface/lib/classes/custom_datasource.inc.php 25 ●●●●● patch | view | raw | blame | history
interface/web/sites/form/webdav_user.tform.php 7 ●●●●● patch | view | raw | blame | history
interface/lib/classes/custom_datasource.inc.php
@@ -63,6 +63,31 @@
        return $records_new;
    }
    
    function webdav_domains($field, $record) {
        global $app, $conf;
        $servers = $app->db->queryAllRecords("SELECT * FROM server WHERE active = 1 AND mirror_server_id = 0");
        $server_ids = array();
        $app->uses('getconf');
        if(is_array($servers) && !empty($servers)){
            foreach($servers as $server){
                $web_config = $app->getconf->get_server_config($server['server_id'], 'web');
                if($web_config['server_type'] != 'nginx') $server_ids[] = $server['server_id'];
            }
        }
        $server_ids = implode(',', $server_ids);
        $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND server_id IN (".$server_ids.") AND ".$app->tform->getAuthSQL('r')." ORDER BY domain");
        $records_new = array();
        if(is_array($records)) {
            foreach($records as $rec) {
                $key = $rec['domain_id'];
                $records_new[$key] = $rec['domain'];
            }
        }
        return $records_new;
    }
    
    function client_servers($field, $record) {
        global $app, $conf;
interface/web/sites/form/webdav_user.tform.php
@@ -73,10 +73,9 @@
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => '',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
                                        'keyfield'=> 'domain_id',
                                        'valuefield'=> 'domain'
            'datasource'    => array (     'type'    => 'CUSTOM',
                                        'class'=> 'custom_datasource',
                                        'function'=> 'webdav_domains'
                                     ),
            'value'        => ''
        ),