System
System

This class encapsulates core LnBlog system functions.

The system class exists in order to provide functions that are global to the installation rather then particular to a blog or user.  This includes things such as listing blogs and users, maintaining user permissions, and so forth.

This may not be the best way to accomplish this particular purpose.  However, it is very convenient and doesn't cause any design problems for the time being.

Functions
getBlogList
public function getBlogList()

Get a list of blogs handled by LnBlog.

Returns

An array of blog objects.

getThemeList
public function getThemeList()

Gets a list of installed system and user themes.

Returns

An array of theme names.

getUserBlogs
public function getUserBlogs(
$usr
)

Gets the list of blogs to which a given user can add posts.

Parameters
usr

A User object for the user to check.

Returns

An array of Blog objects.

getUserList
public function getUserList()

Get a list of all users.

Returns

An array of user objects.

getGroupList
public function getGroupList()

Gets a list of groups.

Parameters
usr

The user whose groups we want to get.

Returns

An array of group names.

getGroups
public function getGroups(
$usrid
)

Gets the groups to which a particular user belongs.

Parameters
usrid

The username of the user in question.

Returns

An array of group names.

inGroup
public function inGroup(
$usrid,
$grp
)

Determines whether or not a particular user belongs to a given group.

Parameters
usrid

The username of the user to check.

grp

The group name to which the user should belong.

Returns

True if usrid is in grp or if everyone is in grp, false otherwise.

groupExists
public function groupExists(
$grp
)

Determines if a specified group exists or not.

Parameters
grp

The group name to check.

Returns

True if the group exists, false otherwise.

addToGroup
public function addToGroup(
&$usr,
$group
)

Adds a user to a group.

Parameters
usr

A user object representing the user to add.

group

The group name to add the user to.

Returns

True on success, false on failure.  If the user is already in the group, then the return value is true.  If the group does not exist, the value is false.

hasAdministrator
public function hasAdministrator()

Determines if there is at least one user who is a system administrator.

Returns

True if the user defined by the ADMIN_USER constant exists or if there is at least one existing user in the administrators group, false otherwise.

isOwner
public function isOwner(
$usrid,
$obj
)

Determines if a given user owns an object.

Parameters
usrid

The username of the user to check.

obj

The object to check.  Must have a uid or owner property.

Returns

True if the user is the object's owner, false otherwise.

canAddTo
public function canAddTo(
$parm,
$usrfalse
)

Determines if a given user has permissions to add child objects to some particular object.

Parameters
parm

An object of some kind, usually a Blog, BlogEntry, or Article.

usr

A User object for the user whose permissions we want to check.  Returns: True if the

canModify
public function canModify(
$parm,
$usrfalse
)

Like canAddTo, except determines if the user can perform updates.

canDelete
public function canDelete(
$parm,
$usrfalse
)

Like canAddTo, except determines if the user can delete the object.