本文整理汇总了PHP中MEMBER::teamRights方法的典型用法代码示例。如果您正苦于以下问题:PHP MEMBER::teamRights方法的具体用法?PHP MEMBER::teamRights怎么用?PHP MEMBER::teamRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEMBER
的用法示例。
在下文中一共展示了MEMBER::teamRights方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getItem
/**
* Returns one item (Nucleus version)
*/
function _getItem($itemid, $username, $password)
{
global $manager;
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!$manager->existsItem($itemid, 1, 1)) {
return _error(6, "No such item ({$itemid})");
}
$blogid = getBlogIDFromItemID($itemid);
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
// 3. return the item
// Structure returned has dateCreated, userid, blogid and content
$item =& $manager->getItem($itemid, 1, 1);
// (also allow drafts and future items)
$blog = new BLOG($blogid);
if ($blog->convertBreaks()) {
$item['body'] = removeBreaks($item['body']);
}
$newstruct = new xmlrpcval(array("publishDate" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "title" => new xmlrpcval($item['title'], "string"), "body" => new xmlrpcval($item['body'], "string"), "more" => new xmlrpcval($item['more'], "string"), "draft" => new xmlrpcval($item['draft'], "boolean"), "closed" => new xmlrpcval($item['closed'], "boolean")), 'struct');
return new xmlrpcresp($newstruct);
}
示例2: _getItemBlogger
/**
* Returns one item (Blogger version)
*/
function _getItemBlogger($itemid, $username, $password)
{
global $manager;
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!$manager->existsItem($itemid, 1, 1)) {
return _error(6, "No such item ({$itemid})");
}
$blogid = getBlogIDFromItemID($itemid);
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
// 3. return the item
// Structure returned has dateCreated, userid, blogid and content
$item =& $manager->getItem($itemid, 1, 1);
// (also allow drafts and future items)
$blog = new BLOG($blogid);
// get category
$item['category'] = $blog->getCategoryName($item['catid']);
// remove linebreaks if needed
if ($blog->convertBreaks()) {
$item['body'] = removeBreaks($item['body']);
}
$content = blogger_specialTags($item) . $item['body'];
$newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "content" => new xmlrpcval($content, "string")), 'struct');
return new xmlrpcresp($newstruct);
}
示例3: _mt_getRecentPostTitles
function _mt_getRecentPostTitles($blogid, $username, $password, $iAmount)
{
$blogid = intval($blogid);
$iAmount = intval($iAmount);
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!BLOG::existsID($blogid)) {
return _error(2, "No such blog ({$blogid})");
}
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
$iAmount = intval($iAmount);
if ($iAmount < 1) {
return _error(5, "Amount parameter must be positive");
}
// 3. create and return list of recent items
// Struct returned has dateCreated, userid, postid and title
$blog = new BLOG($blogid);
$structarray = array();
// the array in which the structs will be stored
$query = "SELECT inumber, ititle as title, itime, iauthor" . ' FROM ' . sql_table('item') . " WHERE iblog={$blogid}" . " ORDER BY itime DESC" . " LIMIT {$iAmount}";
$r = sql_query($query);
while ($row = sql_fetch_assoc($r)) {
$newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode(strtotime($row['itime'])), "dateTime.iso8601"), "postid" => new xmlrpcval($row['inumber'], "string"), "title" => new xmlrpcval($row['title'], "string"), "userid" => new xmlrpcval($row['iauthor'], "string")), 'struct');
array_push($structarray, $newstruct);
}
return new xmlrpcresp(new xmlrpcval($structarray, "array"));
}
示例4: _setSkinPart
function _setSkinPart($blogid, $username, $password, $content, $type)
{
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!BLOG::existsID($blogid)) {
return _error(2, "No such blog ({$blogid})");
}
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
// 3. update skin part
$blog = new BLOG($blogid);
$skin = new SKIN($blog->getDefaultSkin());
$skin->update($type, $content);
return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
}
示例5: _mw_getPost
function _mw_getPost($itemid, $username, $password)
{
global $manager;
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed
if (!$manager->existsItem($itemid, 1, 1)) {
return _error(6, "No such item ({$itemid})");
}
$blogid = getBlogIDFromItemID($itemid);
if (!$mem->teamRights($blogid)) {
return _error(3, "Not a team member");
}
// 3. return the item
$item =& $manager->getItem($itemid, 1, 1);
// (also allow drafts and future items)
$b = new BLOG($blogid);
if ($b->convertBreaks()) {
$item['body'] = removeBreaks($item['body']);
$item['more'] = removeBreaks($item['more']);
}
$categoryname = $b->getCategoryName($item['catid']);
$newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "postid" => new xmlrpcval($itemid, "string"), "description" => new xmlrpcval($item['body'], "string"), "title" => new xmlrpcval($item['title'], "string"), "categories" => new xmlrpcval(array(new xmlrpcval($categoryname, "string")), "array"), "mt_text_more" => new xmlrpcval($item['more'], "string"), "mt_allow_comments" => new xmlrpcval($item['closed'] ? 0 : 1, "int"), "mt_allow_pings" => new xmlrpcval(1, "int")), 'struct');
//TODO: add "String link" to struct?
//TODO: add "String permaLink" to struct?
return new xmlrpcresp($newstruct);
}