]> git.mxchange.org Git - friendica.git/blobdiff - mod/share.php
More usage of dbm::is_result($r) instead of count($r):
[friendica.git] / mod / share.php
index f3a221eb8ef4c985f9b8ad9e86a523efb8a4fa61..0a34c6fc50699dd1923872f78d0aae8338be6820 100644 (file)
@@ -1,20 +1,18 @@
 <?php
-
-if(! function_exists('share_init')) {
 function share_init(&$a) {
 
        $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
        if((! $post_id) || (! local_user()))
                killme();
 
-       $r = q("SELECT item.*, contact.network FROM `item`
-               inner join contact on `item`.`contact-id` = `contact`.`id`
+       $r = q("SELECT item.*, contact.network FROM `item` 
+               inner join contact on `item`.`contact-id` = `contact`.`id` 
                WHERE `item`.`id` = %d AND `item`.`uid` = %d LIMIT 1",
 
                intval($post_id),
                intval(local_user())
        );
-       if(! count($r) || ($r[0]['private'] == 1))
+       if(! dbm::is_result($r) || ($r[0]['private'] == 1))
                killme();
 
        if (!intval(get_config('system','old_share'))) {
@@ -42,9 +40,7 @@ function share_init(&$a) {
        echo $o;
        killme();
 }
-}
 
-if(! function_exists('share_header')) {
 function share_header($author, $profile, $avatar, $guid, $posted, $link) {
        $header = "[share author='".str_replace(array("'", "[", "]"), array("&#x27;", "&#x5B;", "&#x5D;"),$author).
                "' profile='".str_replace(array("'", "[", "]"), array("&#x27;", "&#x5B;", "&#x5D;"),$profile).
@@ -60,4 +56,3 @@ function share_header($author, $profile, $avatar, $guid, $posted, $link) {
 
        return $header;
 }
-}