-
-
Save vekexasia/877e75726f1dc98915fa to your computer and use it in GitHub Desktop.
Flatterizor post on Andreabaccega.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('./classes/flatterizor.class.php'); | |
$mat = new stdClass(); | |
$mat->name = 'Mat'; | |
$mat->permissions = array( ); | |
$mat->permissions['can_write'] = false; | |
$mat->permissions['can_read'] = true; | |
$flatterizor = new ObjectFlatterizor(true); | |
$matGoodLooking = $flatterizor->flatterize($mat); | |
var_dump($matGoodLooking); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
O:8:"stdClass":2:{s:4:"name";s:3:"Mat";s:11:"permissions";a:2:s:9:"can_write";b:0;s:8:"can_read";b:1;}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$bob = new stdClass(); | |
$bob->name = 'Bob'; | |
$bob->permissions = array( ); | |
$bob->permissions['can_write'] = true; | |
$bob->permissions['can_read'] = true; | |
$mat = new stdClass(); | |
$mat->name = 'Mat'; | |
$mat->permissions = array( ); | |
$mat->permissions['can_write'] = false; | |
$mat->permissions['can_read'] = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT userID from userinfos | |
WHERE name='/permissions/[can_write]' | |
AND val='true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS `userinfos` ( | |
`userID` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(256) NOT NULL, | |
`val` varchar(256) NOT NULL, | |
PRIMARY KEY (`userID`,`name`), | |
KEY `name` (`name`) | |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object(stdClass)#4 (2) { | |
["objectDefinitions"]=> | |
array(1) { | |
["/"]=> | |
string(8) "stdClass" | |
} | |
["values"]=> | |
array(3) { | |
[0]=> | |
array(2) { | |
["path"]=> | |
string(5) "/name" | |
["val"]=> | |
string(3) "Mat" | |
} | |
[1]=> | |
array(2) { | |
["path"]=> | |
string(24) "/permissions/[can_write]" | |
["val"]=> | |
bool(false) | |
} | |
[2]=> | |
array(2) { | |
["path"]=> | |
string(23) "/permissions/[can_read]" | |
["val"]=> | |
bool(true) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment