abstractify items, check photos for birthday paradox
This commit is contained in:
parent
38fde6672e
commit
c5031139eb
8 changed files with 93 additions and 109 deletions
17
boot.php
17
boot.php
|
@ -776,6 +776,23 @@ function item_new_uri($hostname,$uid) {
|
|||
return $uri;
|
||||
}}
|
||||
|
||||
if(! function_exists('photo_new_resource')) {
|
||||
function photo_new_resource() {
|
||||
|
||||
do {
|
||||
$found = false;
|
||||
$resource = hash('md5',uniqid(mt_rand(),true));
|
||||
$r = q("SELECT `id` FROM `photo` WHERE `resource-id` = '%s' LIMIT 1",
|
||||
dbesc($resource)
|
||||
);
|
||||
if(count($r))
|
||||
$found = true;
|
||||
} while($found == true);
|
||||
return $resource;
|
||||
}}
|
||||
|
||||
|
||||
|
||||
if(! function_exists('get_uid')) {
|
||||
function get_uid() {
|
||||
return ((x($_SESSION,'uid')) ? intval($_SESSION['uid']) : 0) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue