Example #1
0
function my_projects($username)
{
    list($rc, $cooprojects) = ff_getleadprojects($username);
    if ($rc) {
        $cooprojects = array();
    }
    $myprojectids = array();
    // This allows an extra project to be specified in the URL
    if ($_REQUEST["p"]) {
        $myprojectids[] = $_REQUEST["p"];
    }
    // Get the list of the projects which this user is watching.
    list($rc, $watches) = al_getwatches($username);
    if (!$rc) {
        foreach ($watches as $watch) {
            if (ereg("^(p[0-9]+)-news\$", $watch["eventid"], $pieces)) {
                $myprojectids[] = $pieces[1];
            }
        }
    }
    // Get the list of the projects which this user has sponsored.
    global $memberdonations;
    list($rc, $memberdonations) = ff_memberdonations($username, false);
    if ($rc) {
        $memberdonations = array();
    }
    $myprojectids = array_merge($myprojectids, array_keys($memberdonations));
    // Get the list of projects which this user is subscribed to
    global $subscriptions;
    list($rc, $subscriptions) = ff_showsubscriptions($username);
    if ($rc) {
        $subscriptions = array();
    }
    $myprojectids = array_merge($myprojectids, array_keys($subscriptions));
    list($rc, $myprojects) = ff_getprojectinfo($myprojectids);
    if ($rc) {
        $myprojects = array();
    }
    $myprojects = array_merge($cooprojects, $myprojects);
    uasort($myprojects, cmp_projects);
    return $myprojects;
}
Example #2
0
(at your option) any later version.

Fossfactory-src is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Fossfactory-src.  If not, see <http://www.gnu.org/licenses/>.
*/
$id = scrub($_REQUEST["id"]);
$tab = scrub($_REQUEST["tab"]);
$stop = intval($_REQUEST["stop"]);
if ($GLOBALS["username"]) {
    // Get a list of the current watches
    list($rc, $watches) = al_getwatches($GLOBALS["username"], "{$id}-news");
    if (!$rc) {
        if ($stop) {
            // Make sure the user isn't the project lead.
            // This is just a sanity check since the project lead
            // doesn't have any UI to stop watching.  It still doesn't
            // prevent all possible race conditions, but it should be fine.
            list($rc, $projinfo) = ff_getprojectinfo($id);
            if (!$rc && $projinfo['lead'] !== $GLOBALS["username"]) {
                foreach ($watches as $watch) {
                    al_destroywatch($watch["watchid"]);
                }
            }
        } else {
            if (sizeof($watches) == 0) {
                al_createwatch("{$id}-news", $GLOBALS["username"]);
Example #3
0
</div>
<?php 
    }
}
?>
</div>

<span class=abstract-content>
<?php 
echo formatText(ereg_replace("\n.*", "", $projinfo["reqmts"]));
?>
</span>
<div id="actions"><?php 
if ($username) {
    if ($username !== $projinfo["lead"]) {
        list($rc, $watches) = al_getwatches($username, "{$id}-news");
        if (!$rc) {
            if (sizeof($watches)) {
                ?>
<a title='Click to stop watching this project.' class="first-child" href="watchproject.php?id=<?php 
                echo $id;
                ?>
&tab=<?php 
                echo urlencode($_REQUEST["tab"]);
                ?>
&stop=1">You are watching this project.</a><?php 
            } else {
                ?>
<a title='Click to start watching this project.' class="first-child" href="watchproject.php?id=<?php 
                echo $id;
                ?>
Example #4
0
                 $item->title = $e['subject'];
                 $item->link = $GLOBALS['SITE_URL'] . $e['url'];
                 $item->date = (int) $e['time'];
                 $item->description = formatText($e['body']);
                 $rss->addItem($item);
             }
         }
     }
     $rss->title = '[FF] ' . $pname;
     $rss->description = 'Recent events affecting FOSS Factory project \'' . $pname . '\'';
     $rss->link = $GLOBALS['SITE_URL'] . projurl($pid);
 } else {
     if ($_GET['src'] == 'userevents') {
         include_once "formattext.php";
         $user = scrub($_GET['u']);
         list($rc, $watching) = al_getwatches($user);
         if ($rc == 0) {
             foreach ($watching as $w) {
                 list($rc, $events) = al_getrecentevents('watch:' . $w['eventid']);
                 if ($rc != 0) {
                     continue;
                 }
                 foreach ($events as $e) {
                     $item = new FeedItem();
                     $item->title = $e['subject'];
                     $item->link = $GLOBALS['SITE_URL'] . $e['url'];
                     $item->date = (int) $e['time'];
                     $item->description = formatText($e['body']);
                     $rss->addItem($item);
                 }
             }
Example #5
0
if ($rc == 2) {
    print "No such member: {$username}";
    softexit();
}
if (isset($_REQUEST["deldraft"])) {
    ff_deleteprojectdraft($_REQUEST["deldraft"], $username);
    header("Location: account.php?tab=drafts");
    exit;
}
if (isset($_REQUEST["setprefs"])) {
    list($rc, $news) = al_getwatches($username, "news");
    if ($rc) {
        print "{$rc} {$news}";
        softexit();
    }
    list($rc, $promos) = al_getwatches($username, "promos");
    if ($rc) {
        print "{$rc} {$promos}";
        softexit();
    }
    $rc = ff_setmemberinfo($username, false, false, false, $_REQUEST["prefcharity"]);
    if ($rc[0]) {
        print "{$rc['0']} {$rc['1']}";
        exit;
        header("Location: account.php?tab=prefs&err=1");
        exit;
    }
    if (sizeof($news) > 0 != ("{$_REQUEST['news']}" === "1")) {
        if ($_REQUEST["news"]) {
            al_createwatch("news", $username);
        } else {