本文整理汇总了PHP中MEMBER::canAlterItem方法的典型用法代码示例。如果您正苦于以下问题:PHP MEMBER::canAlterItem方法的具体用法?PHP MEMBER::canAlterItem怎么用?PHP MEMBER::canAlterItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEMBER
的用法示例。
在下文中一共展示了MEMBER::canAlterItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _edititem
/**
* Updates an item. Username and password are required to login
*/
function _edititem($itemid, $username, $password, $catid, $title, $body, $more, $wasdraft, $publish, $closed)
{
global $manager;
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// 2. check if allowed to add to blog
if (!$manager->existsItem($itemid, 1, 1)) {
return _error(6, "No such item ({$itemid})");
}
if (!$mem->canAlterItem($itemid)) {
return _error(7, "Not allowed to alter item");
}
if (strtolower(_CHARSET) != 'utf-8') {
$title = mb_convert_encoding($title, _CHARSET, _CHARSET . ",UTF-8");
$body = mb_convert_encoding($body, _CHARSET, _CHARSET . ",UTF-8");
$more = mb_convert_encoding($more, _CHARSET, _CHARSET . ",UTF-8");
}
// 3. update item
ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, 0);
return new xmlrpcresp(new xmlrpcval(1, "boolean"));
}
示例2: _mt_getPostCategories
function _mt_getPostCategories($itemid, $username, $password)
{
global $manager;
// login
$mem = new MEMBER();
if (!$mem->login($username, $password)) {
return _error(1, "Could not log in");
}
// check if item exists
if (!$manager->existsItem($itemid, 1, 1)) {
return _error(6, "No such item ({$itemid})");
}
$blogid = getBlogIDFromItemID($itemid);
$blog = new BLOG($blogid);
if (!$mem->canAlterItem($itemid)) {
return _error(7, 'You are not allowed to request this information');
}
$info =& $manager->getItem($itemid, 1, 1);
$catName = $blog->getCategoryName($info['catid']);
$struct = new xmlrpcval(array('categoryId' => new xmlrpcval($catName, 'string'), 'categoryName' => new xmlrpcval($catName, 'string'), 'isPrimary' => new xmlrpcval(1, 'boolean')), 'struct');
return new xmlrpcresp(new xmlrpcval(array($struct), 'array'));
}