@@ -5,18 +5,18 @@ discard block |
||
5 | 5 | { |
6 | 6 | protected $data = null; |
7 | 7 | |
8 | - function count($filter=false) |
|
8 | + function count($filter = false) |
|
9 | 9 | { |
10 | 10 | throw new \Exception('Unimplemented'); |
11 | 11 | } |
12 | 12 | |
13 | - function search($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
13 | + function search($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
14 | 14 | { |
15 | - if($this->data === null) |
|
15 | + if ($this->data === null) |
|
16 | 16 | { |
17 | 17 | throw new \Exception('Unimplemented'); |
18 | 18 | } |
19 | - if($filter !== false) |
|
19 | + if ($filter !== false) |
|
20 | 20 | { |
21 | 21 | $array = $filter->filter_array($this->data); |
22 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | throw new \Exception('Unimplemented'); |
29 | 29 | } |
30 | 30 | |
31 | - function read($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
31 | + function read($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
32 | 32 | { |
33 | 33 | return $this->search($filter, $select, $count, $skip, $sort, $params); |
34 | 34 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | function __construct($string = false) |
11 | 11 | { |
12 | - if($string !== false) |
|
12 | + if ($string !== false) |
|
13 | 13 | { |
14 | 14 | $this->string = $string; |
15 | 15 | $this->children = self::process_string($this->string); |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | { |
21 | 21 | $parens = false; |
22 | 22 | //First check for parenthesis... |
23 | - if($string[0] === '(' && substr($string, -1) === ')') |
|
23 | + if ($string[0] === '(' && substr($string, -1) === ')') |
|
24 | 24 | { |
25 | - $string = substr($string, 1, strlen($string)-2); |
|
25 | + $string = substr($string, 1, strlen($string) - 2); |
|
26 | 26 | $parens = true; |
27 | 27 | } |
28 | - if(preg_match('/(.+?)( and | or )(.+)/', $string, $clauses) === 0) |
|
28 | + if (preg_match('/(.+?)( and | or )(.+)/', $string, $clauses) === 0) |
|
29 | 29 | { |
30 | 30 | return array(new FilterClause($string)); |
31 | 31 | } |
32 | 32 | $children = array(); |
33 | - if($parens) array_push($children, '('); |
|
33 | + if ($parens) array_push($children, '('); |
|
34 | 34 | $children = array_merge($children, self::process_string($clauses[1])); |
35 | 35 | array_push($children, trim($clauses[2])); |
36 | 36 | $children = array_merge($children, self::process_string($clauses[3])); |
37 | - if($parens) array_push($children, ')'); |
|
37 | + if ($parens) array_push($children, ')'); |
|
38 | 38 | return $children; |
39 | 39 | } |
40 | 40 | |
@@ -42,23 +42,23 @@ discard block |
||
42 | 42 | { |
43 | 43 | $ret = ''; |
44 | 44 | $count = count($this->children); |
45 | - for($i = 0; $i < $count; $i++) |
|
45 | + for ($i = 0; $i < $count; $i++) |
|
46 | 46 | { |
47 | - if($this->children[$i] === '(' || $this->children[$i] === ')') |
|
47 | + if ($this->children[$i] === '(' || $this->children[$i] === ')') |
|
48 | 48 | { |
49 | - $ret.=$this->children[$i]; |
|
49 | + $ret .= $this->children[$i]; |
|
50 | 50 | } |
51 | - else if($this->children[$i] === 'and') |
|
51 | + else if ($this->children[$i] === 'and') |
|
52 | 52 | { |
53 | - $ret.=' AND '; |
|
53 | + $ret .= ' AND '; |
|
54 | 54 | } |
55 | - else if($this->children[$i] === 'or') |
|
55 | + else if ($this->children[$i] === 'or') |
|
56 | 56 | { |
57 | - $ret.=' OR '; |
|
57 | + $ret .= ' OR '; |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | - $ret.=$this->children[$i]->to_sql_string(); |
|
61 | + $ret .= $this->children[$i]->to_sql_string(); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | return $ret.$this->sqlAppend; |
@@ -69,19 +69,19 @@ discard block |
||
69 | 69 | $ret = ''; |
70 | 70 | $count = count($this->children); |
71 | 71 | $prefix = ''; |
72 | - for($i = 0; $i < $count; $i++) |
|
72 | + for ($i = 0; $i < $count; $i++) |
|
73 | 73 | { |
74 | - if($this->children[$i] === 'and') |
|
74 | + if ($this->children[$i] === 'and') |
|
75 | 75 | { |
76 | - if($prefix == '|') |
|
76 | + if ($prefix == '|') |
|
77 | 77 | { |
78 | 78 | throw new \Exception('Do not support both and or'); |
79 | 79 | } |
80 | 80 | $prefix = '&'; |
81 | 81 | } |
82 | - else if($this->children[$i] === 'or') |
|
82 | + else if ($this->children[$i] === 'or') |
|
83 | 83 | { |
84 | - if($prefix == '&') |
|
84 | + if ($prefix == '&') |
|
85 | 85 | { |
86 | 86 | throw new \Exception('Do not support both and or'); |
87 | 87 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | } |
90 | 90 | else |
91 | 91 | { |
92 | - $ret.=$this->children[$i]->to_ldap_string(); |
|
92 | + $ret .= $this->children[$i]->to_ldap_string(); |
|
93 | 93 | } |
94 | 94 | } |
95 | - if($count === 1 && $prefix === '') |
|
95 | + if ($count === 1 && $prefix === '') |
|
96 | 96 | { |
97 | 97 | return $ret; |
98 | 98 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | { |
104 | 104 | $ret = array(); |
105 | 105 | $count = count($this->children); |
106 | - for($i = 0; $i < $count; $i++) |
|
106 | + for ($i = 0; $i < $count; $i++) |
|
107 | 107 | { |
108 | - if($this->children[$i] === 'and') |
|
108 | + if ($this->children[$i] === 'and') |
|
109 | 109 | { |
110 | 110 | $old = array_pop($ret); |
111 | 111 | array_push($ret, array('$and'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
112 | 112 | } |
113 | - else if($this->children[$i] === 'or') |
|
113 | + else if ($this->children[$i] === 'or') |
|
114 | 114 | { |
115 | 115 | $old = array_pop($ret); |
116 | 116 | array_push($ret, array('$or'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | array_push($ret, $this->children[$i]->to_mongo_filter()); |
121 | 121 | } |
122 | 122 | } |
123 | - if(count($ret) == 1 && is_array($ret[0])) |
|
123 | + if (count($ret) == 1 && is_array($ret[0])) |
|
124 | 124 | { |
125 | 125 | //print_r(json_encode($ret[0])); die(); |
126 | 126 | return $ret[0]; |
@@ -131,27 +131,27 @@ discard block |
||
131 | 131 | function filter_array(&$array) |
132 | 132 | { |
133 | 133 | $res = array(); |
134 | - if(is_array($array)) |
|
134 | + if (is_array($array)) |
|
135 | 135 | { |
136 | 136 | $search = $array; |
137 | 137 | $count = count($this->children); |
138 | - for($i = 0; $i < $count; $i++) |
|
138 | + for ($i = 0; $i < $count; $i++) |
|
139 | 139 | { |
140 | - if($this->children[$i] === 'and') |
|
140 | + if ($this->children[$i] === 'and') |
|
141 | 141 | { |
142 | 142 | $search = $res; |
143 | 143 | } |
144 | - else if($this->children[$i] === 'or') |
|
144 | + else if ($this->children[$i] === 'or') |
|
145 | 145 | { |
146 | 146 | $search = $array; |
147 | 147 | } |
148 | 148 | else |
149 | 149 | { |
150 | - foreach($search as $subarray) |
|
150 | + foreach ($search as $subarray) |
|
151 | 151 | { |
152 | - if(isset($subarray[$this->children[$i]->var1])) |
|
152 | + if (isset($subarray[$this->children[$i]->var1])) |
|
153 | 153 | { |
154 | - if($this->children[$i]->php_compare($subarray[$this->children[$i]->var1])) |
|
154 | + if ($this->children[$i]->php_compare($subarray[$this->children[$i]->var1])) |
|
155 | 155 | { |
156 | 156 | array_push($res, $subarray); |
157 | 157 | } |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | public function getClause($substr) |
172 | 172 | { |
173 | 173 | $count = count($this->children); |
174 | - for($i = 0; $i < $count; $i++) |
|
174 | + for ($i = 0; $i < $count; $i++) |
|
175 | 175 | { |
176 | - if(!is_object($this->children[$i])) continue; |
|
177 | - if(strstr($this->children[$i]->var1, $substr) !== false || |
|
176 | + if (!is_object($this->children[$i])) continue; |
|
177 | + if (strstr($this->children[$i]->var1, $substr) !== false || |
|
178 | 178 | strstr($this->children[$i]->var2, $substr) !== false) |
179 | 179 | { |
180 | 180 | return $this->children[$i]; |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | |
185 | 185 | public function addToSQLString($string) |
186 | 186 | { |
187 | - $this->sqlAppend.=$string; |
|
187 | + $this->sqlAppend .= $string; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public function appendChild($child) |
191 | 191 | { |
192 | - if($child === 'and' || $child === 'or') |
|
192 | + if ($child === 'and' || $child === 'or') |
|
193 | 193 | { |
194 | 194 | array_push($this->children, $child); |
195 | 195 | return; |
196 | 196 | } |
197 | - else if(is_a($child, '\Data\Filter')) |
|
197 | + else if (is_a($child, '\Data\Filter')) |
|
198 | 198 | { |
199 | 199 | $this->children = array_merge($this->children, $child->children); |
200 | 200 | } |
@@ -30,11 +30,15 @@ discard block |
||
30 | 30 | return array(new FilterClause($string)); |
31 | 31 | } |
32 | 32 | $children = array(); |
33 | - if($parens) array_push($children, '('); |
|
33 | + if($parens) { |
|
34 | + array_push($children, '('); |
|
35 | + } |
|
34 | 36 | $children = array_merge($children, self::process_string($clauses[1])); |
35 | 37 | array_push($children, trim($clauses[2])); |
36 | 38 | $children = array_merge($children, self::process_string($clauses[3])); |
37 | - if($parens) array_push($children, ')'); |
|
39 | + if($parens) { |
|
40 | + array_push($children, ')'); |
|
41 | + } |
|
38 | 42 | return $children; |
39 | 43 | } |
40 | 44 | |
@@ -47,16 +51,13 @@ discard block |
||
47 | 51 | if($this->children[$i] === '(' || $this->children[$i] === ')') |
48 | 52 | { |
49 | 53 | $ret.=$this->children[$i]; |
50 | - } |
|
51 | - else if($this->children[$i] === 'and') |
|
54 | + } else if($this->children[$i] === 'and') |
|
52 | 55 | { |
53 | 56 | $ret.=' AND '; |
54 | - } |
|
55 | - else if($this->children[$i] === 'or') |
|
57 | + } else if($this->children[$i] === 'or') |
|
56 | 58 | { |
57 | 59 | $ret.=' OR '; |
58 | - } |
|
59 | - else |
|
60 | + } else |
|
60 | 61 | { |
61 | 62 | $ret.=$this->children[$i]->to_sql_string(); |
62 | 63 | } |
@@ -78,16 +79,14 @@ discard block |
||
78 | 79 | throw new \Exception('Do not support both and or'); |
79 | 80 | } |
80 | 81 | $prefix = '&'; |
81 | - } |
|
82 | - else if($this->children[$i] === 'or') |
|
82 | + } else if($this->children[$i] === 'or') |
|
83 | 83 | { |
84 | 84 | if($prefix == '&') |
85 | 85 | { |
86 | 86 | throw new \Exception('Do not support both and or'); |
87 | 87 | } |
88 | 88 | $prefix = '|'; |
89 | - } |
|
90 | - else |
|
89 | + } else |
|
91 | 90 | { |
92 | 91 | $ret.=$this->children[$i]->to_ldap_string(); |
93 | 92 | } |
@@ -109,13 +108,11 @@ discard block |
||
109 | 108 | { |
110 | 109 | $old = array_pop($ret); |
111 | 110 | array_push($ret, array('$and'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
112 | - } |
|
113 | - else if($this->children[$i] === 'or') |
|
111 | + } else if($this->children[$i] === 'or') |
|
114 | 112 | { |
115 | 113 | $old = array_pop($ret); |
116 | 114 | array_push($ret, array('$or'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
117 | - } |
|
118 | - else |
|
115 | + } else |
|
119 | 116 | { |
120 | 117 | array_push($ret, $this->children[$i]->to_mongo_filter()); |
121 | 118 | } |
@@ -140,12 +137,10 @@ discard block |
||
140 | 137 | if($this->children[$i] === 'and') |
141 | 138 | { |
142 | 139 | $search = $res; |
143 | - } |
|
144 | - else if($this->children[$i] === 'or') |
|
140 | + } else if($this->children[$i] === 'or') |
|
145 | 141 | { |
146 | 142 | $search = $array; |
147 | - } |
|
148 | - else |
|
143 | + } else |
|
149 | 144 | { |
150 | 145 | foreach($search as $subarray) |
151 | 146 | { |
@@ -173,7 +168,9 @@ discard block |
||
173 | 168 | $count = count($this->children); |
174 | 169 | for($i = 0; $i < $count; $i++) |
175 | 170 | { |
176 | - if(!is_object($this->children[$i])) continue; |
|
171 | + if(!is_object($this->children[$i])) { |
|
172 | + continue; |
|
173 | + } |
|
177 | 174 | if(strstr($this->children[$i]->var1, $substr) !== false || |
178 | 175 | strstr($this->children[$i]->var2, $substr) !== false) |
179 | 176 | { |
@@ -193,12 +190,10 @@ discard block |
||
193 | 190 | { |
194 | 191 | array_push($this->children, $child); |
195 | 192 | return; |
196 | - } |
|
197 | - else if(is_a($child, '\Data\Filter')) |
|
193 | + } else if(is_a($child, '\Data\Filter')) |
|
198 | 194 | { |
199 | 195 | $this->children = array_merge($this->children, $child->children); |
200 | - } |
|
201 | - else |
|
196 | + } else |
|
202 | 197 | { |
203 | 198 | $this->children = array_merge($this->children, self::process_string($child)); |
204 | 199 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $collections = $this->db->getCollectionNames(); |
66 | 66 | if(in_array($name, $collections)) |
67 | 67 | { |
68 | - return true; |
|
68 | + return true; |
|
69 | 69 | } |
70 | 70 | return false; |
71 | 71 | } |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | { |
12 | 12 | $namespace = substr($classname, 0, $lastNsPos); |
13 | 13 | $classname = substr($classname, $lastNsPos + 1); |
14 | - $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
14 | + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
15 | 15 | } |
16 | - if(strlen($namespace)) |
|
16 | + if (strlen($namespace)) |
|
17 | 17 | { |
18 | - $namespace.=DIRECTORY_SEPARATOR; |
|
18 | + $namespace .= DIRECTORY_SEPARATOR; |
|
19 | 19 | } |
20 | 20 | $filename = __DIR__.'/../libs/mongofill/src/'.$namespace.$classname.'.php'; |
21 | - if(is_readable($filename)) |
|
21 | + if (is_readable($filename)) |
|
22 | 22 | { |
23 | 23 | require $filename; |
24 | 24 | } |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | $this->mangaer = null; |
38 | 38 | $this->db = null; |
39 | 39 | $this->db_name = null; |
40 | - if(class_exists('MongoClient')) |
|
40 | + if (class_exists('MongoClient')) |
|
41 | 41 | { |
42 | 42 | $this->setupMongoClient($params); |
43 | 43 | } |
44 | - else if(class_exists('\MongoDB\Driver\Manager')) |
|
44 | + else if (class_exists('\MongoDB\Driver\Manager')) |
|
45 | 45 | { |
46 | 46 | $this->setupMongoManager($params); |
47 | 47 | } |
48 | 48 | else |
49 | 49 | { |
50 | 50 | require __DIR__.'/../libs/mongofill/src/functions.php'; |
51 | - if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
51 | + if (version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
52 | 52 | { |
53 | 53 | spl_autoload_register('\Data\MongofillAutoload', true, true); |
54 | 54 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | function tableExists($name) |
64 | 64 | { |
65 | 65 | $collections = $this->db->getCollectionNames(); |
66 | - if(in_array($name, $collections)) |
|
66 | + if (in_array($name, $collections)) |
|
67 | 67 | { |
68 | 68 | return true; |
69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | function getTable($name) |
74 | 74 | { |
75 | - if($this->db !== null) |
|
75 | + if ($this->db !== null) |
|
76 | 76 | { |
77 | 77 | return new MongoDataTable($this->db->selectCollection($name)); |
78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | private function setupMongoClient($params) |
86 | 86 | { |
87 | - if(isset($params['user'])) |
|
87 | + if (isset($params['user'])) |
|
88 | 88 | { |
89 | 89 | $this->client = new \MongoClient('mongodb://'.$params['host'].'/'.$params['db'], array('username'=>$params['user'], 'password'=>$params['pass'])); |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | private function setupMongoManager($params) |
99 | 99 | { |
100 | - if(isset($params['user'])) |
|
100 | + if (isset($params['user'])) |
|
101 | 101 | { |
102 | 102 | $this->manager = new \MongoDB\Driver\Manager('mongodb://'.$params['user'].':'.$params['pass'].'@'.$params['host'].'/'.$params['db']); |
103 | 103 | } |
@@ -40,19 +40,16 @@ discard block |
||
40 | 40 | if(class_exists('MongoClient')) |
41 | 41 | { |
42 | 42 | $this->setupMongoClient($params); |
43 | - } |
|
44 | - else if(class_exists('\MongoDB\Driver\Manager')) |
|
43 | + } else if(class_exists('\MongoDB\Driver\Manager')) |
|
45 | 44 | { |
46 | 45 | $this->setupMongoManager($params); |
47 | - } |
|
48 | - else |
|
46 | + } else |
|
49 | 47 | { |
50 | 48 | require __DIR__.'/../libs/mongofill/src/functions.php'; |
51 | 49 | if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
52 | 50 | { |
53 | 51 | spl_autoload_register('\Data\MongofillAutoload', true, true); |
54 | - } |
|
55 | - else |
|
52 | + } else |
|
56 | 53 | { |
57 | 54 | spl_autoload_register('\Data\MongofillAutoload'); |
58 | 55 | } |
@@ -75,8 +72,7 @@ discard block |
||
75 | 72 | if($this->db !== null) |
76 | 73 | { |
77 | 74 | return new MongoDataTable($this->db->selectCollection($name)); |
78 | - } |
|
79 | - else |
|
75 | + } else |
|
80 | 76 | { |
81 | 77 | return new MongoDataTable($this->db_name, $name); |
82 | 78 | } |
@@ -87,8 +83,7 @@ discard block |
||
87 | 83 | if(isset($params['user'])) |
88 | 84 | { |
89 | 85 | $this->client = new \MongoClient('mongodb://'.$params['host'].'/'.$params['db'], array('username'=>$params['user'], 'password'=>$params['pass'])); |
90 | - } |
|
91 | - else |
|
86 | + } else |
|
92 | 87 | { |
93 | 88 | $this->client = new \MongoClient('mongodb://'.$params['host'].'/'.$params['db']); |
94 | 89 | } |
@@ -100,8 +95,7 @@ discard block |
||
100 | 95 | if(isset($params['user'])) |
101 | 96 | { |
102 | 97 | $this->manager = new \MongoDB\Driver\Manager('mongodb://'.$params['user'].':'.$params['pass'].'@'.$params['host'].'/'.$params['db']); |
103 | - } |
|
104 | - else |
|
98 | + } else |
|
105 | 99 | { |
106 | 100 | $this->manager = new \MongoDB\Driver\Manager('mongodb://'.$params['host'].'/'.$params['db']); |
107 | 101 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @link http://www.php.net/manual/en/class.jsonserializable.php |
11 | 11 | */ |
12 | 12 | |
13 | -if(PHP_VERSION_ID < 50400) |
|
13 | +if (PHP_VERSION_ID < 50400) |
|
14 | 14 | { |
15 | 15 | /** |
16 | 16 | * JsonSerializable interface |
@@ -247,15 +247,15 @@ |
||
247 | 247 | */ |
248 | 248 | protected function printIeCompatability($prefix='') |
249 | 249 | { |
250 | - //IE 8 doesn't support HTML 5. Install the shim... |
|
251 | - if($this->getBrowserMajorVer() < 9) |
|
252 | - { |
|
253 | - echo $prefix.'<script src="js/html5.js"></script>'; |
|
254 | - echo "\n"; |
|
255 | - } |
|
256 | - //Tell the browser not to use compatability mode... |
|
257 | - echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
258 | - echo "\n"; |
|
250 | + //IE 8 doesn't support HTML 5. Install the shim... |
|
251 | + if($this->getBrowserMajorVer() < 9) |
|
252 | + { |
|
253 | + echo $prefix.'<script src="js/html5.js"></script>'; |
|
254 | + echo "\n"; |
|
255 | + } |
|
256 | + //Tell the browser not to use compatability mode... |
|
257 | + echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
258 | + echo "\n"; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $this->importSupport = false; |
59 | 59 | |
60 | 60 | $browserName = $this->getBrowserName(); |
61 | - if($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
61 | + if ($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
62 | 62 | { |
63 | - header( 'Location: /badbrowser.php' ) ; |
|
63 | + header('Location: /badbrowser.php'); |
|
64 | 64 | } |
65 | - else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
65 | + else if ($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
66 | 66 | { |
67 | 67 | $this->importSupport = true; |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function getBrowscap() |
79 | 79 | { |
80 | - if(isset($GLOBALS['BROWSCAP_CACHE'])) |
|
80 | + if (isset($GLOBALS['BROWSCAP_CACHE'])) |
|
81 | 81 | { |
82 | 82 | return new Browscap($GLOBALS['BROWSCAP_CACHE']); |
83 | 83 | } |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function getBrowser() |
91 | 91 | { |
92 | - static $browser;//No accident can arise from depending on an unset variable. |
|
93 | - if(!isset($browser)) |
|
92 | + static $browser; //No accident can arise from depending on an unset variable. |
|
93 | + if (!isset($browser)) |
|
94 | 94 | { |
95 | 95 | $browser = $this->browscap->getBrowser(); |
96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | private function getBrowserName() |
104 | 104 | { |
105 | - if(isset($this->browser->Browser)) |
|
105 | + if (isset($this->browser->Browser)) |
|
106 | 106 | { |
107 | 107 | return $this->browser->Browser; |
108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | private function getBrowserMajorVer() |
119 | 119 | { |
120 | - if(isset($this->browser->MajorVer)) |
|
120 | + if (isset($this->browser->MajorVer)) |
|
121 | 121 | { |
122 | 122 | return $this->browser->MajorVer; |
123 | 123 | } |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return string The tag as a string |
192 | 192 | */ |
193 | - protected function createOpenTag($tagName, $attribs=array(), $selfClose=false) |
|
193 | + protected function createOpenTag($tagName, $attribs = array(), $selfClose = false) |
|
194 | 194 | { |
195 | 195 | $tag = '<'.$tagName; |
196 | 196 | $attribNames = array_keys($attribs); |
197 | - foreach($attribNames as $attribName) |
|
197 | + foreach ($attribNames as $attribName) |
|
198 | 198 | { |
199 | - $tag.=' '.$attribName; |
|
200 | - if($attribs[$attribName]) |
|
199 | + $tag .= ' '.$attribName; |
|
200 | + if ($attribs[$attribName]) |
|
201 | 201 | { |
202 | - $tag.='="'.$attribs[$attribName].'"'; |
|
202 | + $tag .= '="'.$attribs[$attribName].'"'; |
|
203 | 203 | } |
204 | 204 | } |
205 | - if($selfClose) |
|
205 | + if ($selfClose) |
|
206 | 206 | { |
207 | 207 | return $tag.'/>'; |
208 | 208 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string The link |
231 | 231 | */ |
232 | - public function createLink($linkName, $linkTarget='#') |
|
232 | + public function createLink($linkName, $linkTarget = '#') |
|
233 | 233 | { |
234 | 234 | $startTag = $this->createOpenTag('a', array('href'=>$linkTarget)); |
235 | 235 | $endTag = $this->createCloseTag('a'); |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @param string $prefix The prefix to append to each line |
247 | 247 | */ |
248 | - protected function printIeCompatability($prefix='') |
|
248 | + protected function printIeCompatability($prefix = '') |
|
249 | 249 | { |
250 | 250 | //IE 8 doesn't support HTML 5. Install the shim... |
251 | - if($this->getBrowserMajorVer() < 9) |
|
251 | + if ($this->getBrowserMajorVer() < 9) |
|
252 | 252 | { |
253 | 253 | echo $prefix.'<script src="js/html5.js"></script>'; |
254 | 254 | echo "\n"; |
@@ -263,16 +263,16 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @param string $prefix The prefix to append to each line |
265 | 265 | */ |
266 | - protected function printHead($prefix='') |
|
266 | + protected function printHead($prefix = '') |
|
267 | 267 | { |
268 | 268 | echo $prefix.'<HEAD>'; |
269 | - if($this->getBrowserName() === 'IE') |
|
269 | + if ($this->getBrowserName() === 'IE') |
|
270 | 270 | { |
271 | 271 | $this->printIeCompatability($prefix.$prefix); |
272 | 272 | } |
273 | 273 | echo $prefix.$prefix.'<TITLE>'.$this->title.'</TITLE>'; |
274 | 274 | echo $prefix.$prefix.'<meta name="viewport" content="width=device-width, initial-scale=1.0">'; |
275 | - foreach($this->headTags as $tag) |
|
275 | + foreach ($this->headTags as $tag) |
|
276 | 276 | { |
277 | 277 | echo $prefix.$prefix.$tag."\n"; |
278 | 278 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @param string $prefix The prefix to append to each line |
286 | 286 | */ |
287 | - protected function printBody($prefix='') |
|
287 | + protected function printBody($prefix = '') |
|
288 | 288 | { |
289 | 289 | echo $prefix.'<BODY '.$this->body_tags.'>'; |
290 | 290 | echo $prefix.$prefix.$this->body."\n"; |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function currentURL() |
314 | 314 | { |
315 | - if(!isset($_SERVER['REQUEST_URI'])) |
|
315 | + if (!isset($_SERVER['REQUEST_URI'])) |
|
316 | 316 | { |
317 | 317 | return ''; |
318 | 318 | } |
319 | 319 | $requestURI = $_SERVER['REQUEST_URI']; |
320 | - if($requestURI[0] === '/') |
|
320 | + if ($requestURI[0] === '/') |
|
321 | 321 | { |
322 | 322 | $requestURI = substr($requestURI, 1); |
323 | 323 | } |
324 | - return 'http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
324 | + return 'http'.(isset($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -61,8 +61,7 @@ |
||
61 | 61 | if($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
62 | 62 | { |
63 | 63 | header( 'Location: /badbrowser.php' ) ; |
64 | - } |
|
65 | - else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
64 | + } else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
66 | 65 | { |
67 | 66 | $this->importSupport = true; |
68 | 67 | } |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | protected function __construct() |
38 | 38 | { |
39 | 39 | $this->methods = array(); |
40 | - if(isset(FlipsideSettings::$email_providers)) |
|
40 | + if (isset(FlipsideSettings::$email_providers)) |
|
41 | 41 | { |
42 | 42 | $keys = array_keys(FlipsideSettings::$email_providers); |
43 | 43 | $count = count($keys); |
44 | - for($i = 0; $i < $count; $i++) |
|
44 | + for ($i = 0; $i < $count; $i++) |
|
45 | 45 | { |
46 | 46 | $class = $keys[$i]; |
47 | 47 | array_push($this->methods, new $class(FlipsideSettings::$email_providers[$keys[$i]])); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | public function getEmailMethod($methodName) |
60 | 60 | { |
61 | 61 | $count = count($this->methods); |
62 | - for($i = 0; $i < $count; $i++) |
|
62 | + for ($i = 0; $i < $count; $i++) |
|
63 | 63 | { |
64 | - if(strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
64 | + if (strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
65 | 65 | { |
66 | 66 | return $this->methods[$i]; |
67 | 67 | } |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function sendEmail($email, $methodName = false) |
81 | 81 | { |
82 | - if($methodName === false) |
|
82 | + if ($methodName === false) |
|
83 | 83 | { |
84 | 84 | $res = false; |
85 | 85 | $count = count($this->methods); |
86 | - for($i = 0; $i < $count; $i++) |
|
86 | + for ($i = 0; $i < $count; $i++) |
|
87 | 87 | { |
88 | 88 | $res = $this->methods[$i]->sendEmail($email); |
89 | - if($res !== false) |
|
89 | + if ($res !== false) |
|
90 | 90 | { |
91 | 91 | return $res; |
92 | 92 | } |
@@ -34,8 +34,7 @@ |
||
34 | 34 | $args['RawMessage'] = array(); |
35 | 35 | $args['RawMessage']['Data'] = base64_encode($email->getRawMessage()); |
36 | 36 | return $this->ses->sendRawEmail($args); |
37 | - } |
|
38 | - else |
|
37 | + } else |
|
39 | 38 | { |
40 | 39 | $args = array(); |
41 | 40 | $args['Source'] = $email->getFromAddress(); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | 'version' => 'latest', |
15 | 15 | 'region' => 'us-west-2', |
16 | 16 | 'credentials' => $credentials |
17 | - ]); |
|
17 | + ]); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function canSend() |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | public function sendEmail($email) |
29 | 29 | { |
30 | - if($email->hasAttachments()) |
|
30 | + if ($email->hasAttachments()) |
|
31 | 31 | { |
32 | 32 | //Amazeon sendEmail doesn't support attachments. We need to use sendRawEmail |
33 | 33 | $args = array(); |
@@ -34,8 +34,7 @@ |
||
34 | 34 | $args['RawMessage'] = array(); |
35 | 35 | $args['RawMessage']['Data'] = base64_encode($email->getRawMessage()); |
36 | 36 | return $this->ses->sendRawEmail($args); |
37 | - } |
|
38 | - else |
|
37 | + } else |
|
39 | 38 | { |
40 | 39 | $args = array(); |
41 | 40 | $args['Source'] = $email->getFromAddress(); |
@@ -3,19 +3,19 @@ discard block |
||
3 | 3 | |
4 | 4 | class LDAPObject extends \SerializableObject |
5 | 5 | { |
6 | - public $server; |
|
6 | + public $server; |
|
7 | 7 | |
8 | - function __construct($array=false, $server=false) |
|
9 | - { |
|
10 | - parent::__construct($array); |
|
11 | - $this->server = $server; |
|
12 | - } |
|
8 | + function __construct($array=false, $server=false) |
|
9 | + { |
|
10 | + parent::__construct($array); |
|
11 | + $this->server = $server; |
|
12 | + } |
|
13 | 13 | |
14 | - public function jsonSerialize() |
|
15 | - { |
|
16 | - $ret = array(); |
|
17 | - foreach ($this as $key => $value) |
|
18 | - { |
|
14 | + public function jsonSerialize() |
|
15 | + { |
|
16 | + $ret = array(); |
|
17 | + foreach ($this as $key => $value) |
|
18 | + { |
|
19 | 19 | if($key === 'server' || $key === 'count') continue; |
20 | 20 | if(is_numeric($key)) continue; |
21 | 21 | if($key === 'jpegphoto') |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | { |
32 | 32 | $ret[$key] = $value; |
33 | 33 | } |
34 | - } |
|
35 | - return $ret; |
|
36 | - } |
|
34 | + } |
|
35 | + return $ret; |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | ?> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | { |
6 | 6 | public $server; |
7 | 7 | |
8 | - function __construct($array=false, $server=false) |
|
8 | + function __construct($array = false, $server = false) |
|
9 | 9 | { |
10 | 10 | parent::__construct($array); |
11 | 11 | $this->server = $server; |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | $ret = array(); |
17 | 17 | foreach ($this as $key => $value) |
18 | 18 | { |
19 | - if($key === 'server' || $key === 'count') continue; |
|
20 | - if(is_numeric($key)) continue; |
|
21 | - if($key === 'jpegphoto') |
|
19 | + if ($key === 'server' || $key === 'count') continue; |
|
20 | + if (is_numeric($key)) continue; |
|
21 | + if ($key === 'jpegphoto') |
|
22 | 22 | { |
23 | 23 | $ret[$key] = base64_encode($value[0]); |
24 | 24 | continue; |
25 | 25 | } |
26 | - if(is_array($value) && $value['count'] === 1) |
|
26 | + if (is_array($value) && $value['count'] === 1) |
|
27 | 27 | { |
28 | 28 | $ret[$key] = $value[0]; |
29 | 29 | } |
@@ -16,8 +16,12 @@ discard block |
||
16 | 16 | $ret = array(); |
17 | 17 | foreach ($this as $key => $value) |
18 | 18 | { |
19 | - if($key === 'server' || $key === 'count') continue; |
|
20 | - if(is_numeric($key)) continue; |
|
19 | + if($key === 'server' || $key === 'count') { |
|
20 | + continue; |
|
21 | + } |
|
22 | + if(is_numeric($key)) { |
|
23 | + continue; |
|
24 | + } |
|
21 | 25 | if($key === 'jpegphoto') |
22 | 26 | { |
23 | 27 | $ret[$key] = base64_encode($value[0]); |
@@ -26,8 +30,7 @@ discard block |
||
26 | 30 | if(is_array($value) && $value['count'] === 1) |
27 | 31 | { |
28 | 32 | $ret[$key] = $value[0]; |
29 | - } |
|
30 | - else |
|
33 | + } else |
|
31 | 34 | { |
32 | 35 | $ret[$key] = $value; |
33 | 36 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * use the FlipsideSettings class |
16 | 16 | */ |
17 | -if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
17 | +if (isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
18 | 18 | { |
19 | 19 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
20 | 20 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | static function getDataSetByName($setName) |
60 | 60 | { |
61 | 61 | static $instances = array(); |
62 | - if(isset($instances[$setName])) |
|
62 | + if (isset($instances[$setName])) |
|
63 | 63 | { |
64 | 64 | return $instances[$setName]; |
65 | 65 | } |
66 | - if(!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$setName])) |
|
66 | + if (!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$setName])) |
|
67 | 67 | { |
68 | 68 | throw new Exception('Unknown dataset name '.$setName); |
69 | 69 | } |
@@ -17,8 +17,7 @@ |
||
17 | 17 | if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
18 | 18 | { |
19 | 19 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
20 | -} |
|
21 | -else |
|
20 | +} else |
|
22 | 21 | { |
23 | 22 | require_once('/var/www/secure_settings/class.FlipsideSettings.php'); |
24 | 23 | } |