本文整理汇总了PHP中User_group::idsFromText方法的典型用法代码示例。如果您正苦于以下问题:PHP User_group::idsFromText方法的具体用法?PHP User_group::idsFromText怎么用?PHP User_group::idsFromText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User_group
的用法示例。
在下文中一共展示了User_group::idsFromText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveNew
//.........这里部分代码省略.........
common_log(LOG_WARNING, "Attempted post from user disallowed to post: " . $profile->nickname);
// TRANS: Client exception thrown when a user tries to post while being banned.
throw new ClientException(_('You are banned from posting notices on this site.'), 403);
}
$notice = new Notice();
$notice->profile_id = $profile_id;
$autosource = common_config('public', 'autosource');
// Sandboxed are non-false, but not 1, either
if (!$profile->hasRight(Right::PUBLICNOTICE) || $source && $autosource && in_array($source, $autosource)) {
$notice->is_local = Notice::LOCAL_NONPUBLIC;
} else {
$notice->is_local = $is_local;
}
if (!empty($created)) {
$notice->created = $created;
} else {
$notice->created = common_sql_now();
}
if (!$notice->isLocal()) {
// Only do these checks for non-local notices. Local notices will generate these values later.
if (!common_valid_http_url($url)) {
common_debug('Bad notice URL: [' . $url . '], URI: [' . $uri . ']. Cannot link back to original! This is normal for shared notices etc.');
}
if (empty($uri)) {
throw new ServerException('No URI for remote notice. Cannot accept that.');
}
}
$notice->content = $final;
$notice->source = $source;
$notice->uri = $uri;
$notice->url = $url;
// Get the groups here so we can figure out replies and such
if (!isset($groups)) {
$groups = User_group::idsFromText($notice->content, $profile);
}
$reply = null;
// Handle repeat case
if (!empty($options['repeat_of'])) {
// Check for a private one
$repeat = Notice::getByID($options['repeat_of']);
if ($profile->sameAs($repeat->getProfile())) {
// TRANS: Client error displayed when trying to repeat an own notice.
throw new ClientException(_('You cannot repeat your own notice.'));
}
if ($repeat->scope != Notice::SITE_SCOPE && $repeat->scope != Notice::PUBLIC_SCOPE) {
// TRANS: Client error displayed when trying to repeat a non-public notice.
throw new ClientException(_('Cannot repeat a private notice.'), 403);
}
if (!$repeat->inScope($profile)) {
// The generic checks above should cover this, but let's be sure!
// TRANS: Client error displayed when trying to repeat a notice you cannot access.
throw new ClientException(_('Cannot repeat a notice you cannot read.'), 403);
}
if ($profile->hasRepeated($repeat)) {
// TRANS: Client error displayed when trying to repeat an already repeated notice.
throw new ClientException(_('You already repeated that notice.'));
}
$notice->repeat_of = $repeat->id;
$notice->conversation = $repeat->conversation;
} else {
$reply = null;
// If $reply_to is specified, we check that it exists, and then
// return it if it does
if (!empty($reply_to)) {
$reply = Notice::getKV('id', $reply_to);
} elseif (in_array($source, array('xmpp', 'mail', 'sms'))) {