removes php warnings/notices

This commit is contained in:
Hannes Mannerheim 2016-01-07 16:39:46 +01:00
parent 3c6243ac50
commit cc950a4cf0
2 changed files with 14 additions and 9 deletions

View File

@ -1111,7 +1111,9 @@ class QvitterPlugin extends Plugin {
// loop through the groups guessed by gnu social's common_find_mentions() and correct them
foreach($mentions as $mention_array_id=>$mention) {
foreach($correct_groups as $correct_groups_array_id=>$correct_group) {
if($mention['mentioned'][0]->nickname == $correct_group->nickname
if(isset($mention['mentioned'][0]->nickname)
&& isset($correct_group->nickname)
&& $mention['mentioned'][0]->nickname == $correct_group->nickname
&& !isset($mentions[$mention_array_id]['corrected'])) {
$user_group_profile = Profile::getKV('id',$correct_group->profile_id);
$mentions[$mention_array_id]['mentioned'][0] = $user_group_profile;

View File

@ -145,15 +145,18 @@ class QvitterAction extends ApiAction
if(stristr($group_id_or_name,'/id')) {
$group_id_or_name = substr($group_id_or_name, 0, strpos($group_id_or_name,'/id'));
$group = User_group::getKV('id', $group_id_or_name);
$group_name = $group->nickname;
$group_id = $group_id_or_name;
}
else {
if($group instanceof User_group) {
$group_name = $group->nickname;
$group_id = $group_id_or_name;
}
} else {
$group = Local_group::getKV('nickname', $group_id_or_name);
$group_id = $group->group_id;
$group_name = $group_id_or_name;
}
if(preg_match("/^[a-zA-Z0-9]+$/", $group_id_or_name) == 1) {
if($group instanceof Local_group) {
$group_id = $group->group_id;
$group_name = $group_id_or_name;
}
}
if(preg_match("/^[a-zA-Z0-9]+$/", $group_id_or_name) == 1 && isset($group_name) && isset($group_id)) {
?>
<link rel="alternate" href="<?php echo htmlspecialchars(common_local_url('ApiTimelineGroup', array('id'=>$group_id, 'format'=>'as'))); ?>" type="application/stream+json" title="Notice feed for '<?php echo htmlspecialchars($group_name); ?>' group (Activity Streams JSON)" />