public function load($bucketid) { $io = new FileIO(); $bucketConfigString = $io->readFile(Constants::GET_PAGES_DIRECTORY() . '/' . $bucketid . '/.bucket'); $config = unserialize($bucketConfigString); if (isset($config['type'])) { $type = $config['type']; switch ($type) { case BucketTypes::Text: return $this->buildTextBucket($config); break; case BucketTypes::Blog: return $this->buildBlogBucket($config); break; default: break; } } }
public function readConfig($configString) { $config; $configFileName = Constants::GET_PAGES_DIRECTORY() . '/' . $this->getBucketId() . '/.bucket'; $io = new FileIO(); if ($io->fileExists($configFileName)) { $serializedConfig = $io->readFile($configFileName); $config = unserialize($serializedConfig); } return $config; }
$message = ''; if (!isset($_SESSION['UID']) || !isset($_SESSION['USER'])) { //If the form is submitted, then check the username and password if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['loginp']) && isset($_POST['loginu'])) { $u = $_POST['loginu']; $p = $_POST['loginp']; $p = sha1($p); //Unserialize all our users to check for a user with this name $io = new FileIO(); $users = array(); $userFiles = $io->getDirectoryFiles(Constants::GET_USERS_DIRECTORY()); $cuser = new User('dummy1', 'dummy2'); $userFound = false; foreach ($userFiles as $userFile) { $val = $io->readFile(Constants::GET_USERS_DIRECTORY() . '/' . $userFile); $cuser = unserialize($val); if ($cuser->getUsername() == $u) { $userFound = true; break; } } if ($userFound) { if ($cuser->getPassword() == $p) { $_SESSION['UID'] = $cuser->getUsername(); $_SESSION['USER'] = $cuser; header("Location: " . get_absolute_uri('index.php')); } else { $message = "Please try again"; } } else {