diff options
author | Mario Vavti <mario@mariovavti.com> | 2022-10-20 11:15:06 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2022-10-20 11:15:06 +0200 |
commit | 53931017b99c6fc77fc7632747e51b06a89b2287 (patch) | |
tree | 26357decc1d3a76471863b3f58a0a0455d637e33 /Zotlabs/Module/Sitelist.php | |
parent | e9ca17cec14c5a702cc7d656e5206a3c086dd550 (diff) | |
download | volse-hubzilla-53931017b99c6fc77fc7632747e51b06a89b2287.tar.gz volse-hubzilla-53931017b99c6fc77fc7632747e51b06a89b2287.tar.bz2 volse-hubzilla-53931017b99c6fc77fc7632747e51b06a89b2287.zip |
fix php warnings
Diffstat (limited to 'Zotlabs/Module/Sitelist.php')
-rw-r--r-- | Zotlabs/Module/Sitelist.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Zotlabs/Module/Sitelist.php b/Zotlabs/Module/Sitelist.php index 2ac5ed1b8..9908aa651 100644 --- a/Zotlabs/Module/Sitelist.php +++ b/Zotlabs/Module/Sitelist.php @@ -5,63 +5,63 @@ namespace Zotlabs\Module; /** @file */ class Sitelist extends \Zotlabs\Web\Controller { function init() { - - $start = (($_REQUEST['start']) ? intval($_REQUEST['start']) : 0); - $limit = ((intval($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 30); - $order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'random'); - $open = (($_REQUEST['open']) ? intval($_REQUEST['open']) : false); - - + + $start = ((isset($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0); + $limit = ((isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 30); + $order = ((isset($_REQUEST['order'])) ? $_REQUEST['order'] : 'random'); + $open = ((isset($_REQUEST['open'])) ? intval($_REQUEST['open']) : false); + + $sql_order = " order by site_url "; $rand = db_getfunc('rand'); if($order == 'random') $sql_order = " order by $rand "; - + $sql_limit = " LIMIT $limit OFFSET $start "; - + $sql_extra = ""; if($open) $sql_extra = " and site_register = " . intval(REGISTER_OPEN) . " "; - + $realm = get_directory_realm(); if($realm == DIRECTORY_REALM) { $sql_extra .= " and ( site_realm = '" . dbesc($realm) . "' or site_realm = '') "; } else $sql_extra .= " and site_realm = '" . dbesc($realm) . "' "; - + $result = array('success' => false); - + $r = q("select count(site_url) as total from site where site_type = %d and site_dead = 0 $sql_extra ", intval(SITE_TYPE_ZOT) ); - + if($r) $result['total'] = intval($r[0]['total']); - + $result['start'] = $start; - $result['limit'] = $limit; - + $result['limit'] = $limit; + $r = q("select * from site where site_type = %d and site_dead = 0 $sql_extra $sql_order $sql_limit", intval(SITE_TYPE_ZOT) ); - + $result['results'] = 0; $result['entries'] = array(); - + if($r) { - $result['success'] = true; + $result['success'] = true; $result['results'] = count($r); - + foreach($r as $rr) { $result['entries'][] = array('url' => $rr['site_url']); } - + } - + echo json_encode($result); killme(); - - + + } } |