Пример #1
0
 public function saveBlock()
 {
     $io = new FileIO();
     //Build the file name from the bucket path (includes the bucket extension)
     //and the block id.
     $filename = Constants::GET_PAGES_DIRECTORY() . '/' . $this->getBucketId() . '/' . $this->getBlockId() . '.incl';
     $serialized = serialize($this);
     $io = new FileIO();
     $io->writeFile($filename, $serialized);
 }
Пример #2
0
 public function writeConfig()
 {
     $properties = $this->getConfigProperties();
     //Add the id and type, as these will always be written
     $config['bucketid'] = $this->getBucketId();
     $config['type'] = $this->getType();
     //Instantiate an instance of ReflectionClass, on the $this class type
     $reflectionClass = new ReflectionClass(get_class($this));
     foreach ($properties as $prop) {
         $val = $reflectionClass->getProperty($prop)->getValue($this);
         $config[$prop] = $val;
     }
     $io = new FileIO();
     $path = Constants::GET_PAGES_DIRECTORY() . "/" . $this->getBucketId() . "/.bucket";
     $serializedConfig = serialize($config);
     $io->writeFile($path, $serializedConfig);
     return true;
 }
Пример #3
0
 private function createUser($username, $password, $usertype, $pagePermissions)
 {
     $io = new FileIO();
     $newuser = new User($username, $usertype);
     $newuser->setPassword($password);
     if (!empty($pagePermissions)) {
         foreach ($pagePermissions as $page => $perm) {
             $newuser->addPagePermission($page, $perm);
         }
     }
     $filename = Constants::GET_USERS_DIRECTORY() . '/' . $username . '.usr';
     $serialized = serialize($newuser);
     return $io->writeFile($filename, $serialized);
 }