1
0
Fork 0

Improve dba::selectFirst calls

- Fix remaining $r[0] references
- Rename $r to meaningful names
This commit is contained in:
Hypolite Petovan 2018-01-11 03:26:30 -05:00
commit 5fc4927764
29 changed files with 228 additions and 250 deletions

View file

@ -145,20 +145,19 @@ function proxy_init(App $a) {
}
$valid = true;
$r = array();
$photo = null;
if (!$direct_cache && ($cachefile == '')) {
$r = dba::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
if (DBM::is_result($r)) {
$img_str = $r['data'];
$mime = $r['desc'];
$photo = dba::selectFirst('photo', ['data', 'desc'], ['resource-id' => $urlhash]);
if (DBM::is_result($photo)) {
$img_str = $photo['data'];
$mime = $photo['desc'];
if ($mime == '') {
$mime = 'image/jpeg';
}
}
}
if (!DBM::is_result($r)) {
if (!DBM::is_result($photo)) {
// It shouldn't happen but it does - spaces in URL
$_REQUEST['url'] = str_replace(' ', '+', $_REQUEST['url']);
$redirects = 0;