@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function send_HTML($mail) |
24 | 24 | { |
25 | - if(isset($mail['from'])) |
|
25 | + if (isset($mail['from'])) |
|
26 | 26 | { |
27 | 27 | $this->From = $mail['from']; |
28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $this->From = $this->Username; |
32 | 32 | } |
33 | - if(isset($mail['from_name'])) |
|
33 | + if (isset($mail['from_name'])) |
|
34 | 34 | { |
35 | 35 | $this->FromName = $mail['from_name']; |
36 | 36 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->FromName = 'Burning Flipside'; |
40 | 40 | } |
41 | 41 | $this->clearAllRecipients(); |
42 | - if(is_array($mail['to'])) |
|
42 | + if (is_array($mail['to'])) |
|
43 | 43 | { |
44 | 44 | array_walk($mail['to'], 'FlipsideMail::addTo', $this); |
45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $this->addAddress($mail['to']); |
49 | 49 | } |
50 | - if(isset($mail['reply_to'])) |
|
50 | + if (isset($mail['reply_to'])) |
|
51 | 51 | { |
52 | 52 | $this->addReplyTo($mail['reply_to']); |
53 | 53 | } |
@@ -25,16 +25,14 @@ discard block |
||
25 | 25 | if(isset($mail['from'])) |
26 | 26 | { |
27 | 27 | $this->From = $mail['from']; |
28 | - } |
|
29 | - else |
|
28 | + } else |
|
30 | 29 | { |
31 | 30 | $this->From = $this->Username; |
32 | 31 | } |
33 | 32 | if(isset($mail['from_name'])) |
34 | 33 | { |
35 | 34 | $this->FromName = $mail['from_name']; |
36 | - } |
|
37 | - else |
|
35 | + } else |
|
38 | 36 | { |
39 | 37 | $this->FromName = 'Burning Flipside'; |
40 | 38 | } |
@@ -42,8 +40,7 @@ discard block |
||
42 | 40 | if(is_array($mail['to'])) |
43 | 41 | { |
44 | 42 | array_walk($mail['to'], 'FlipsideMail::addTo', $this); |
45 | - } |
|
46 | - else |
|
43 | + } else |
|
47 | 44 | { |
48 | 45 | $this->addAddress($mail['to']); |
49 | 46 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | static $instances = array(); |
30 | 30 | $class = get_called_class(); |
31 | - if(!isset($instances[$class])) |
|
31 | + if (!isset($instances[$class])) |
|
32 | 32 | { |
33 | 33 | $instances[$class] = new static(); |
34 | 34 | } |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | if(isset($params['filter'])) |
16 | 16 | { |
17 | 17 | $this->filter = new \Data\Filter($params['filter']); |
18 | - } |
|
19 | - else if(isset($params['$filter'])) |
|
18 | + } else if(isset($params['$filter'])) |
|
20 | 19 | { |
21 | 20 | $this->filter = new \Data\Filter($params['$filter']); |
22 | 21 | } |
@@ -29,8 +28,7 @@ discard block |
||
29 | 28 | if(isset($params['select'])) |
30 | 29 | { |
31 | 30 | $this->select = explode(',',$params['select']); |
32 | - } |
|
33 | - else if(isset($params['$select'])) |
|
31 | + } else if(isset($params['$select'])) |
|
34 | 32 | { |
35 | 33 | $this->select = explode(',',$params['$select']); |
36 | 34 | } |
@@ -47,8 +45,7 @@ discard block |
||
47 | 45 | { |
48 | 46 | //Default to assending |
49 | 47 | $this->orderby[$exp[0]] = 1; |
50 | - } |
|
51 | - else |
|
48 | + } else |
|
52 | 49 | { |
53 | 50 | switch($exp[1]) |
54 | 51 | { |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function processFilter($params) |
54 | 54 | { |
55 | - if(isset($params['filter'])) |
|
55 | + if (isset($params['filter'])) |
|
56 | 56 | { |
57 | 57 | $this->filter = new \Data\Filter($params['filter']); |
58 | 58 | } |
59 | - else if(isset($params['$filter'])) |
|
59 | + else if (isset($params['$filter'])) |
|
60 | 60 | { |
61 | 61 | $this->filter = new \Data\Filter($params['$filter']); |
62 | 62 | } |
@@ -64,42 +64,42 @@ discard block |
||
64 | 64 | |
65 | 65 | protected function processExpand($params) |
66 | 66 | { |
67 | - if(isset($params['$expand'])) |
|
67 | + if (isset($params['$expand'])) |
|
68 | 68 | { |
69 | - $this->expand = explode(',',$params['$expand']); |
|
69 | + $this->expand = explode(',', $params['$expand']); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function processSelect($params) |
74 | 74 | { |
75 | - if(isset($params['select'])) |
|
75 | + if (isset($params['select'])) |
|
76 | 76 | { |
77 | - $this->select = explode(',',$params['select']); |
|
77 | + $this->select = explode(',', $params['select']); |
|
78 | 78 | } |
79 | - else if(isset($params['$select'])) |
|
79 | + else if (isset($params['$select'])) |
|
80 | 80 | { |
81 | - $this->select = explode(',',$params['$select']); |
|
81 | + $this->select = explode(',', $params['$select']); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function processOrderBy($params) |
86 | 86 | { |
87 | - if(isset($params['$orderby'])) |
|
87 | + if (isset($params['$orderby'])) |
|
88 | 88 | { |
89 | 89 | $this->orderby = array(); |
90 | - $orderby = explode(',',$params['$orderby']); |
|
90 | + $orderby = explode(',', $params['$orderby']); |
|
91 | 91 | $count = count($orderby); |
92 | - for($i = 0; $i < $count; $i++) |
|
92 | + for ($i = 0; $i < $count; $i++) |
|
93 | 93 | { |
94 | - $exp = explode(' ',$orderby[$i]); |
|
95 | - if(count($exp) === 1) |
|
94 | + $exp = explode(' ', $orderby[$i]); |
|
95 | + if (count($exp) === 1) |
|
96 | 96 | { |
97 | 97 | //Default to assending |
98 | 98 | $this->orderby[$exp[0]] = 1; |
99 | 99 | } |
100 | 100 | else |
101 | 101 | { |
102 | - switch($exp[1]) |
|
102 | + switch ($exp[1]) |
|
103 | 103 | { |
104 | 104 | case 'asc': |
105 | 105 | $this->orderby[$exp[0]] = 1; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | protected function processTop($params) |
119 | 119 | { |
120 | - if(isset($params['$top']) && is_numeric($params['$top'])) |
|
120 | + if (isset($params['$top']) && is_numeric($params['$top'])) |
|
121 | 121 | { |
122 | 122 | $this->top = intval($params['$top']); |
123 | 123 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | protected function processSkip($params) |
127 | 127 | { |
128 | - if(isset($params['$skip']) && is_numeric($params['$skip'])) |
|
128 | + if (isset($params['$skip']) && is_numeric($params['$skip'])) |
|
129 | 129 | { |
130 | 130 | $this->skip = intval($params['$skip']); |
131 | 131 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | protected function processCount($params) |
135 | 135 | { |
136 | - if(isset($params['$count']) && strcasecmp($params['$count'], 'true') === 0) |
|
136 | + if (isset($params['$count']) && strcasecmp($params['$count'], 'true') === 0) |
|
137 | 137 | { |
138 | 138 | $this->count = true; |
139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | protected function processSearch($params) |
143 | 143 | { |
144 | - if(isset($params['$search'])) |
|
144 | + if (isset($params['$search'])) |
|
145 | 145 | { |
146 | 146 | throw new Exception('Search not yet implemented'); |
147 | 147 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public function getUserFromToken($token) |
32 | 32 | { |
33 | - if($token === false) |
|
33 | + if ($token === false) |
|
34 | 34 | { |
35 | 35 | $token = \FlipSession::getVar('OAuthToken'); |
36 | 36 | } |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | protected $collection; |
7 | 7 | protected $namespace; |
8 | 8 | |
9 | - public function __construct($collection, $collection_name=false) |
|
9 | + public function __construct($collection, $collection_name = false) |
|
10 | 10 | { |
11 | - if($collection_name !== false) |
|
11 | + if ($collection_name !== false) |
|
12 | 12 | { |
13 | 13 | $this->namespace = $collection.'.'.$collection_name; |
14 | 14 | } |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | } |
19 | 19 | } |
20 | 20 | |
21 | - public function count($filter=false) |
|
21 | + public function count($filter = false) |
|
22 | 22 | { |
23 | 23 | $criteria = array(); |
24 | - if($filter !== false) |
|
24 | + if ($filter !== false) |
|
25 | 25 | { |
26 | - if($filter instanceof \Data\Filter) |
|
26 | + if ($filter instanceof \Data\Filter) |
|
27 | 27 | { |
28 | 28 | $criteria = $filter->to_mongo_filter(); |
29 | 29 | } |
@@ -37,44 +37,44 @@ discard block |
||
37 | 37 | |
38 | 38 | private function getCriteriaFromFilter($filter) |
39 | 39 | { |
40 | - if($filter === false) |
|
40 | + if ($filter === false) |
|
41 | 41 | { |
42 | 42 | return array(); |
43 | 43 | } |
44 | - if(is_array($filter)) |
|
44 | + if (is_array($filter)) |
|
45 | 45 | { |
46 | 46 | return $filter; |
47 | 47 | } |
48 | 48 | return $filter->to_mongo_filter(); |
49 | 49 | } |
50 | 50 | |
51 | - public function search($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
51 | + public function search($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
52 | 52 | { |
53 | 53 | $fields = array(); |
54 | 54 | $criteria = $this->getCriteriaFromFilter($filter); |
55 | - if($select !== false) |
|
55 | + if ($select !== false) |
|
56 | 56 | { |
57 | 57 | $fields = array_fill_keys($select, 1); |
58 | 58 | } |
59 | - $cursor = $this->collection->find($criteria, $fields); |
|
60 | - if($params !== false && isset($params['fields'])) |
|
59 | + $cursor = $this->collection->find($criteria, $fields); |
|
60 | + if ($params !== false && isset($params['fields'])) |
|
61 | 61 | { |
62 | 62 | $cursor->fields($params['fields']); |
63 | 63 | } |
64 | - if($sort !== false) |
|
64 | + if ($sort !== false) |
|
65 | 65 | { |
66 | 66 | $cursor->sort($sort); |
67 | 67 | } |
68 | - if($skip !== false) |
|
68 | + if ($skip !== false) |
|
69 | 69 | { |
70 | 70 | $cursor->skip($skip); |
71 | 71 | } |
72 | - if($count !== false) |
|
72 | + if ($count !== false) |
|
73 | 73 | { |
74 | 74 | $cursor->limit($count); |
75 | 75 | } |
76 | - $ret = array(); |
|
77 | - foreach($cursor as $doc) |
|
76 | + $ret = array(); |
|
77 | + foreach ($cursor as $doc) |
|
78 | 78 | { |
79 | 79 | array_push($ret, $doc); |
80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function create($data) |
85 | 85 | { |
86 | 86 | $res = $this->collection->insert($data); |
87 | - if($res === false || $res['err'] !== null) |
|
87 | + if ($res === false || $res['err'] !== null) |
|
88 | 88 | { |
89 | 89 | return false; |
90 | 90 | } |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | public function update($filter, $data) |
95 | 95 | { |
96 | 96 | $criteria = $this->getCriteriaFromFilter($filter); |
97 | - if(isset($data['_id'])) |
|
97 | + if (isset($data['_id'])) |
|
98 | 98 | { |
99 | 99 | unset($data['_id']); |
100 | 100 | } |
101 | 101 | $res = $this->collection->update($criteria, array('$set' => $data)); |
102 | - if($res === false || $res['err'] !== null) |
|
102 | + if ($res === false || $res['err'] !== null) |
|
103 | 103 | { |
104 | 104 | return false; |
105 | 105 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $criteria = $this->getCriteriaFromFilter($filter); |
112 | 112 | $res = $this->collection->remove($criteria); |
113 | - if($res === false || $res['err'] !== null) |
|
113 | + if ($res === false || $res['err'] !== null) |
|
114 | 114 | { |
115 | 115 | return false; |
116 | 116 | } |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | if($collection_name !== false) |
12 | 12 | { |
13 | 13 | $this->namespace = $collection.'.'.$collection_name; |
14 | - } |
|
15 | - else |
|
14 | + } else |
|
16 | 15 | { |
17 | 16 | $this->collection = $collection; |
18 | 17 | } |
@@ -26,8 +25,7 @@ discard block |
||
26 | 25 | if($filter instanceof \Data\Filter) |
27 | 26 | { |
28 | 27 | $criteria = $filter->to_mongo_filter(); |
29 | - } |
|
30 | - else |
|
28 | + } else |
|
31 | 29 | { |
32 | 30 | $criteria = $filter; |
33 | 31 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | if(isset($this->data['mail'])) |
39 | 39 | { |
40 | - return $this->data['mail']; |
|
40 | + return $this->data['mail']; |
|
41 | 41 | } |
42 | 42 | return $this->getUid(); |
43 | 43 | } |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | { |
6 | 6 | private $data; |
7 | 7 | |
8 | - function __construct($data=false) |
|
8 | + function __construct($data = false) |
|
9 | 9 | { |
10 | 10 | $this->data = array(); |
11 | - if($data !== false) |
|
11 | + if ($data !== false) |
|
12 | 12 | { |
13 | 13 | $this->data = $data; |
14 | - if(isset($data['extended'])) |
|
14 | + if (isset($data['extended'])) |
|
15 | 15 | { |
16 | 16 | $this->data = $data['extended']; |
17 | 17 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $uid = $this->getUid(); |
26 | 26 | $filter = new \Data\Filter("uid eq '$uid' and gid eq '$name'"); |
27 | 27 | $groups = $group_data_table->read($filter); |
28 | - if($groups === false || !isset($groups[0])) |
|
28 | + if ($groups === false || !isset($groups[0])) |
|
29 | 29 | { |
30 | 30 | return false; |
31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | function getEmail() |
37 | 37 | { |
38 | - if(isset($this->data['mail'])) |
|
38 | + if (isset($this->data['mail'])) |
|
39 | 39 | { |
40 | 40 | return $this->data['mail']; |
41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | function getUid() |
46 | 46 | { |
47 | - if(isset($this->data['uid'])) |
|
47 | + if (isset($this->data['uid'])) |
|
48 | 48 | { |
49 | 49 | return $this->data['uid']; |
50 | 50 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public function getGroupName() |
14 | 14 | { |
15 | - if(isset($data['gid'])) |
|
15 | + if (isset($data['gid'])) |
|
16 | 16 | { |
17 | 17 | return $data['gid']; |
18 | 18 | } |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | |
22 | 22 | public function getDescription() |
23 | 23 | { |
24 | - if(isset($data['description'])) |
|
24 | + if (isset($data['description'])) |
|
25 | 25 | { |
26 | 26 | return $data['description']; |
27 | 27 | } |
28 | 28 | return false; |
29 | 29 | } |
30 | 30 | |
31 | - public function getMemberUids($recursive=true) |
|
31 | + public function getMemberUids($recursive = true) |
|
32 | 32 | { |
33 | 33 | return $this->members(false, $recursive, true); |
34 | 34 | } |
35 | 35 | |
36 | - public function members($details=false, $recursive=true, $includeGroups=true) |
|
36 | + public function members($details = false, $recursive = true, $includeGroups = true) |
|
37 | 37 | { |
38 | 38 | //TODO |
39 | 39 | return array(); |