create site records for all queued sites and check for death

This commit is contained in:
redmatrix
2015-09-28 17:13:11 -07:00
parent dbeae16dc1
commit e5f47cd14b
9 changed files with 68 additions and 21 deletions

View File

@@ -398,13 +398,15 @@ function list_public_sites() {
$rand = db_getfunc('rand');
$realm = get_directory_realm();
if($realm == DIRECTORY_REALM) {
$r = q("select * from site where site_access != 0 and site_register !=0 and ( site_realm = '%s' or site_realm = '') order by $rand",
dbesc($realm)
$r = q("select * from site where site_access != 0 and site_register !=0 and ( site_realm = '%s' or site_realm = '') and site_type = %d order by $rand",
dbesc($realm),
intval(SITE_TYPE_ZOT)
);
}
else {
$r = q("select * from site where site_access != 0 and site_register !=0 and site_realm = '%s' order by $rand",
dbesc($realm)
$r = q("select * from site where site_access != 0 and site_register !=0 and site_realm = '%s' and site_type = %d order by $rand",
dbesc($realm),
intval(SITE_TYPE_ZOT)
);
}

View File

@@ -22,8 +22,9 @@ function rate_init(&$a) {
$a->poi = $r[0];
}
else {
$r = q("select * from site where site_url like '%s' ",
dbesc('%' . $target)
$r = q("select * from site where site_url like '%s' and site_type = %d",
dbesc('%' . $target),
intval(SITE_TYPE_ZOT)
);
if($r) {
$a->data['site'] = $r[0];

View File

@@ -35,8 +35,9 @@ function ratingsearch_init(&$a) {
if($p)
$target = $p[0]['xchan_hash'];
else {
$p = q("select * from site where site_url like '%s' ",
dbesc('%' . $hash)
$p = q("select * from site where site_url like '%s' and site_type = %d ",
dbesc('%' . $hash),
intval(SITE_TYPE_ZOT)
);
if($p) {
$target = strtolower($hash);

View File

@@ -86,8 +86,9 @@ function regdir_init(&$a) {
if ($dirmode == DIRECTORY_MODE_STANDALONE) {
$r = array(array('site_url' => z_root()));
} else {
$r = q("select site_url from site where site_flags in ( 1, 2 ) and site_realm = '%s' $sql_extra ",
dbesc(get_directory_realm())
$r = q("select site_url from site where site_flags in ( 1, 2 ) and site_realm = '%s' and site_type = %d $sql_extra ",
dbesc(get_directory_realm()),
intval(SITE_TYPE_ZOT)
);
}
if ($r) {

View File

@@ -28,7 +28,9 @@ function sitelist_init(&$a) {
$result = array('success' => false);
$r = q("select count(site_url) as total from site where true $sql_extra ");
$r = q("select count(site_url) as total from site where site_type = %d $sql_extra ",
intval(SITE_TYPE_ZOT)
);
if($r)
$result['total'] = intval($r[0]['total']);
@@ -36,7 +38,9 @@ function sitelist_init(&$a) {
$result['start'] = $start;
$result['limit'] = $limit;
$r = q("select * from site where true $sql_extra $sql_order $sql_limit");
$r = q("select * from site where site_type = %d $sql_extra $sql_order $sql_limit",
intval(SITE_TYPE_ZOT)
);
$result['results'] = 0;
$result['entries'] = array();