-
Notifications
You must be signed in to change notification settings - Fork 28
/
group_wordpress.php
76 lines (66 loc) · 2.08 KB
/
group_wordpress.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
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* ownCloud - Cloudpress
*
* @author Bastien Ho (EELV - Urbancube)
* @copyleft 2012 [email protected]
* @projeturl http://ecolosites.eelv.fr
*
* Free Software under creative commons licence
* http://creativecommons.org/licenses/by-nc/3.0/
* Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)
*
* You are free:
* to Share — to copy, distribute and transmit the work
* to Remix — to adapt the work
*
* Under the following conditions:
* Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that
* suggests that they endorse you or your use of the work).
* Noncommercial — You may not use this work for commercial purposes.
*
*/
class OC_group_wordpress extends OC_Group_Backend {
static $wordpress_db_host;
static $wordpress_db_name;
static $wordpress_db_user;
static $wordpress_db_password;
static $wordpress_db_prefix;
static $wordpress_hash_salt;
static $db;
static $db_conn;
static $wp_all_users;
static $wp_instance;
static $current_user_blogs;
function __construct() {
self::$wp_instance = new OC_wordpress();
self::$db_conn=self::$wp_instance->connectdb();
$uid=OC_User::getUser();
if($uid){
self::$current_user_blogs = self::$wp_instance->getUserblogsIds($uid);
}
}
public function connectdb() {
self::$db_conn = self::$wp_instance->connectdb();
}
public function inGroup($uid, $gid) {
return in_array($gid, self::getUserGroups($uid));
}
public function getUserGroups($uid) {
if (!self::$db_conn)
return array();
return self::$wp_instance->getUserblogs($uid,true);
}
public function getGroups($search = '', $limit = -1, $offset = 0) {
if (!self::$db_conn){
return array();
}
return self::$wp_instance->getAllBlogs(isset($_GET['search'])?$_GET['search']:$search, $limit, $offset);
}
public function groupExists($gid) {
return in_array($gid, self::getGroups($gid, 1));
}
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
return array();
}
}