Changeset 11


Ignore:
Timestamp:
Apr 2, 2007, 5:51:16 PM (11 years ago)
Author:
julian
Message:
Location:
trunk
Files:
2 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/Core.config.class.php

    r5 r11  
    1515            'PrivateMessages',
    1616            'ViewForum',
     17            'ViewProfile',
    1718            'ViewTopic',
    1819            'Posting',
  • trunk/core/Functions.class.php

    r9 r11  
    491491        $DB->query("SELECT t1.*, COUNT(*)-1 AS cat_depth, (t1.cat_r - t1.cat_l - 1) / 2 AS cat_childs_counter FROM ".TBLPFX."cats AS t1, ".TBLPFX."cats AS t2 WHERE t1.CatID='$CatID' AND t1.cat_l BETWEEN t2.cat_l AND t2.cat_r GROUP BY t1.cat_l");
    492492        return ($DB->affected_rows == 0) ? FALSE : $DB->fetch_array();
     493    }
     494
     495    /**
     496     * Returns true if user is mod, false otherwise
     497     *
     498     * @param int $userID
     499     * @return bool
     500     */
     501    static public function checkModStatus($userID) {
     502        $DB = Factory::singleton('DB');
     503
     504        // Erst wird nach einem Mod-Recht des Users gesucht
     505        $DB->query("SELECT authID FROM ".TBLPFX."forums_auth WHERE authType='".AUTH_TYPE_GROUP."' AND authID='$userID' AND authIsMod='1' LIMIT 1");
     506        if($DB->getAffectedRows() > 0) return TRUE;
     507
     508        // Nichts gefunden, also muessen die Gruppen ueberprueft werden, in denen der User Mitglied ist
     509        $DB->query("SELECT groupID FROM ".TBLPFX."groups_members WHERE memberID='$userID'");
     510        $groupIDs = $DB->raw2FVArray();
     511        $DB->query("SELECT authID FROM ".TBLPFX."forums_auth WHERE authType='".AUTH_TYPE_GROUP."' AND authID IN ('".implode("','",$groupIDs)."') AND authIsMod='1' LIMIT 1");
     512        if($DB->getAffectedRows() > 0) return TRUE;
     513
     514        return FALSE; // User ist kein Mod
    493515    }
    494516
Note: See TracChangeset for help on using the changeset viewer.