ftimme
2013-02-27 f4038a2160d55a7f519a3b42be1aa96e29e9a908
interface/lib/classes/tools_sites.inc.php
@@ -58,8 +58,8 @@
    function removePrefix($name, $currentPrefix, $globalPrefix) {
        if($name == "") return "";
        
        if($currentPrefix == '#') return $name; // # = empty prefix, do not change name
        if($currentPrefix === '') $currentPrefix = $globalPrefix; // entry has no prefix set, maybe it was created before this function was introduced
        if($currentPrefix === '') return $name; // empty prefix, do not change name
        if($currentPrefix === '#') $currentPrefix = $globalPrefix; // entry has no prefix set, maybe it was created before this function was introduced
        
        if($currentPrefix === '') return $name; // no current prefix and global prefix is empty -> nothing to remove here.
        
@@ -69,7 +69,7 @@
    function getPrefix($currentPrefix, $userPrefix, $adminPrefix = false) {
        global $app;
        
        if($currentPrefix !== '') return ($currentPrefix == '#' ? '' : $currentPrefix); // return the currently set prefix for this entry (# = empty)
        if($currentPrefix !== '#') return $currentPrefix; // return the currently set prefix for this entry (# = no prefix set yet)
        
        if($adminPrefix === false) $adminPrefix = $userPrefix;
        
@@ -143,6 +143,33 @@
        }
        return $res;
    }
    function getDomainModuleDomains() {
        global $app;
        $sql = "SELECT domain_id, domain FROM domain WHERE";
        if ($_SESSION["s"]["user"]["typ"] == 'admin') {
            $sql .= " 1";
        } else {
            $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
            $sql .= " sys_groupid IN (".$groups.")";
        }
        $sql .= " ORDER BY domain";
        return $app->db->queryAllRecords($sql);
    }
    function checkDomainModuleDomain($domain_id) {
        global $app;
        $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($domain_id);
        if ($_SESSION["s"]["user"]["typ"] != 'admin') {
            $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
            $sql .= " AND sys_groupid IN (".$groups.")";
        }
        $domain = $app->db->queryOneRecord($sql);
        if(!$domain || !$domain['domain_id']) return false;
        return $domain['domain'];
    }
}
?>