Changeset 167

Show
Ignore:
Timestamp:
01/21/06 22:55:45 (3 years ago)
Author:
ben
Message:

Communities can now *unsubscribe* from feeds

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/units/magpie/function_actions.php

    r166 r167  
    1818                                                                                                                break; 
    1919                        // Unsubscribe from an existing feed 
    20                                 case "unsubscribe":                                             if (isset($_REQUEST['feed']) && run("rss:subscribed",$_REQUEST['feed'])) { 
     20                                case "unsubscribe":                                             if (isset($_REQUEST['feed']) && (run("rss:subscribed",$_REQUEST['feed']))) { 
    2121                                                                                                                        $feed = $_REQUEST['feed']; 
    22                                                                                                                         db_query("delete from feed_subscriptions where feed_id = $feed and user_id = ".$_SESSION['userid']); 
     22                                                                                                                        db_query("delete from feed_subscriptions where feed_id = $feed and user_id = $page_owner"); 
    2323                                                                                                                        $messages[] = gettext("Your have successfully removed this feed from your subscriptions."); 
    2424                                                                                                                } else { 
  • devel/units/magpie/function_is_subscribed.php

    r45 r167  
    11<?php 
     2 
     3        $run_result = false; 
    24 
    35        if (logged_on && isset($parameter)) { 
    46 
    5                 global $rss_subscriptions
     7                global $page_owner
    68                $parameter = (int) $parameter; 
    79                 
    8                 run("rss:subscriptions:get"); 
     10                if ($page_owner == $_SESSION['userid']) { 
    911                 
    10                 $run_result = in_array($parameter, $rss_subscriptions); 
     12                        global $rss_subscriptions; 
     13                         
     14                        run("rss:subscriptions:get"); 
     15                         
     16                        $run_result = in_array($parameter, $rss_subscriptions); 
     17                 
     18                } else if (run("permissions:check", "profile")) { 
     19                         
     20                        $result = db_query("select count(*) as numsubs from feed_subscriptions where user_id = $page_owner and ident = $parameter"); 
     21                        if ($result != false && sizeof($result) > 0) { 
     22                                 
     23                                if ($result[0]->numsubs > 0) { 
     24                                         
     25                                        $run_result = true; 
     26                                         
     27                                } 
     28                                 
     29                        } 
     30                         
     31                } 
    1132 
    12         } else { 
    13                 $run_result = false; 
    1433        } 
    1534                 
  • devel/units/magpie/function_subscriptions.php

    r166 r167  
    2828                                $name = "<a href=\"".$feed->siteurl."\">" . stripslashes($feed->name) . "</a>"; 
    2929                                $column2 = "<a href=\"".url."_rss/individual.php?feed=".$feed->ident."\">". gettext("View content") . "</a>"; 
    30                                 if ($_SESSION['userid'] == $page_owner) { 
    31                                         $column2 .= " | <a href=\"".url."_rss/subscriptions.php?action=unsubscribe&amp;feed=".$feed->ident."\" onClick=\"return confirm('".gettext("Are you sure you want to unsubscribe from this feed?")."')\">" . gettext("Unsubscribe") . "</a>"; 
     30                                if (run("permissions:check", "profile")) { 
     31                                        $column2 .= " | <a href=\"".url."_rss/subscriptions.php?action=unsubscribe&amp;feed=".$feed->ident."&amp;profile_id=$page_owner\" onClick=\"return confirm('".gettext("Are you sure you want to unsubscribe from this feed?")."')\">" . gettext("Unsubscribe") . "</a>"; 
    3232                                } 
    3333