-
Notifications
You must be signed in to change notification settings - Fork 1
/
v1_lists.php
65 lines (56 loc) · 1.99 KB
/
v1_lists.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
if (!defined("POUET_API")) exit();
$result = new stdClass();
$s = new BM_query();
$s->AddTable("lists");
$s->AddField("lists.id");
$s->AddField("lists.name");
$s->AddField("lists.desc");
$s->AddField("lists.addedDate");
$s->Attach(array("lists"=>"addedUser"),array("users as addedUser"=>"id"));
$s->Attach(array("lists"=>"owner"),array("users as owner"=>"id"));
$s->AddWhere(sprintf_esc("lists.id=%d",$_GET["id"]));
list($list) = $s->perform();
if ($list)
{
$result->success = true;
$result->list = $list;
$s = new BM_query();
$s->AddTable("list_items");
$s->Attach(array("list_items"=>"itemid"),array("prods as prod"=>"id"));
$s->AddWhere(sprintf_esc("list_items.list=%d",$list->id));
$s->AddWhere("list_items.type='prod'");
$result->list->prods = $s->perform();
$a = array();
foreach($result->list->prods as $p) $a[] = &$p->prod;
PouetCollectPlatforms($a);
$s = new BM_query();
$s->AddTable("list_items");
$s->Attach(array("list_items"=>"itemid"),array("groups as group"=>"id"));
$s->AddWhere(sprintf_esc("list_items.list=%d",$list->id));
$s->AddWhere("list_items.type='group'");
$result->list->groups = $s->perform();
$s = new BM_query();
$s->AddTable("list_items");
$s->Attach(array("list_items"=>"itemid"),array("parties as party"=>"id"));
$s->AddWhere(sprintf_esc("list_items.list=%d",$list->id));
$s->AddWhere("list_items.type='party'");
$result->list->parties = $s->perform();
$s = new BM_query();
$s->AddTable("list_items");
$s->Attach(array("list_items"=>"itemid"),array("users as user"=>"id"));
$s->AddWhere(sprintf_esc("list_items.list=%d",$list->id));
$s->AddWhere("list_items.type='user'");
$result->list->users = $s->perform();
$s = new BM_query();
$s->AddTable("list_maintainers");
$s->Attach(array("list_maintainers"=>"userID"),array("users as user"=>"id"));
$s->AddWhere(sprintf_esc("list_maintainers.listID = %d",$list->id));
$result->list->maintainers = $s->perform();
}
else
{
$result->error = true;
}
output($result);
?>