aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/dirsearch.php5
-rw-r--r--mod/filestorage.php3
-rw-r--r--mod/sharedwithme.php39
-rw-r--r--mod/sitelist.php3
4 files changed, 16 insertions, 34 deletions
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 4a44feb7d..06d530849 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -355,14 +355,15 @@ function dir_parse_query($s) {
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()",
+ $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)
);
}
else {
- $r = q("select * from site where site_access != 0 and site_register !=0 and site_realm = '%s' order by rand()",
+ $r = q("select * from site where site_access != 0 and site_register !=0 and site_realm = '%s' order by $rand",
dbesc($realm)
);
}
diff --git a/mod/filestorage.php b/mod/filestorage.php
index 9852f4e73..05f6a79e6 100644
--- a/mod/filestorage.php
+++ b/mod/filestorage.php
@@ -38,8 +38,9 @@ function filestorage_post(&$a) {
//Build directory tree and redirect
$channel = $a->get_channel();
$cloudPath = get_parent_cloudpath($channel_id, $channel['channel_address'], $resource);
+ $object = get_file_activity_object($channel_id, $resource, $cloudPath);
- file_activity($channel_id, $resource, $cloudPath, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, 'post', $no_activity);
+ file_activity($channel_id, $object, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, 'post', $no_activity);
goaway($cloudPath);
}
diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php
index baaf41f61..8b7d2661c 100644
--- a/mod/sharedwithme.php
+++ b/mod/sharedwithme.php
@@ -24,38 +24,17 @@ function sharedwithme_content(&$a) {
foreach($x as $xx) {
$object = json_decode($xx['object'],true);
- $hash = $object['hash'];
- //If object has a mid it's an update activity - the inlcuded mid is the latest and should not be removed
- $update = (($object['mid']) ? true : false);
+ $d_mid = $object['d_mid'];
+ $u_mid = $xx['mid'];
- if($update) {
-
- $mid = $object['mid'];
-
- unset($object['mid']); //remove mid from object to match the post activity object
-
- $y = q("DELETE FROM item WHERE (mid != '%s' AND obj_type = '%s') AND (object = '%s' AND verb = '%s') OR (object = '%s' AND verb = '%s')",
- dbesc($mid),
- dbesc(ACTIVITY_OBJ_FILE),
- dbesc(json_encode($object)),
- dbesc(ACTIVITY_POST),
- dbesc($xx['object']),
- dbesc(ACTIVITY_UPDATE)
- );
-
- }
-
- else {
-
- $z = q("DELETE FROM item WHERE (obj_type = '%s' AND object LIKE '%s') AND (verb = '%s' OR verb = '%s')",
- dbesc(ACTIVITY_OBJ_FILE),
- dbesc('%"hash":"' . $hash . '"%'),
- dbesc(ACTIVITY_POST),
- dbesc(ACTIVITY_UPDATE)
- );
-
- }
+ $y = q("DELETE FROM item WHERE obj_type = '%s' AND (verb = '%s' AND mid = '%s') OR (verb = '%s' AND mid = '%s')",
+ dbesc(ACTIVITY_OBJ_FILE),
+ dbesc(ACTIVITY_POST),
+ dbesc($d_mid),
+ dbesc(ACTIVITY_UPDATE),
+ dbesc($u_mid)
+ );
}
diff --git a/mod/sitelist.php b/mod/sitelist.php
index 95cf862df..4e52f0463 100644
--- a/mod/sitelist.php
+++ b/mod/sitelist.php
@@ -9,8 +9,9 @@ function sitelist_init(&$a) {
$sql_order = " order by site_url ";
+ $rand = db_getfunc('rand');
if($order == 'random')
- $sql_order = " order by rand() ";
+ $sql_order = " order by $rand ";
$sql_limit = " limit $start, $limit ";