예제 #1
0
 function __construct($name, $perms = null)
 {
     $this->name = $name;
     if ($perms != null) {
         $this->perms = $perms;
     } else {
         $path = Factions::getMStorePath() . DIRECTORY_SEPARATOR . "factions_mperm" . DIRECTORY_SEPARATOR . $name . ".json";
         $rawJSON = json_decode(file_get_contents($path));
         $this->perms = $rawJSON->standard;
     }
 }
예제 #2
0
 public static function getDefaults()
 {
     if (self::$default_perms == null) {
         $perms = array();
         foreach (scandir(Factions::getMStorePath() . DIRECTORY_SEPARATOR . "factions_mperm") as $key => $permRaw) {
             if (!in_array($permRaw, array(".", ".."))) {
                 $path = Factions::getMStorePath() . DIRECTORY_SEPARATOR . "factions_mperm" . DIRECTORY_SEPARATOR . $permRaw;
                 if (is_file($path)) {
                     $permName = basename($permRaw, ".json");
                     $perm = new Perm($permName);
                     $perms[$permName] = $perm;
                 }
             }
         }
         self::$default_perms = $perms;
     }
     return self::$default_perms;
 }