function item_url_replace($channel, &$item, $old, $new) { if ($item['attach']) { json_url_replace($old, $new, $item['attach']); } if ($item['object']) { json_url_replace($old, $new, $item['object']); } if ($item['target']) { json_url_replace($old, $new, $item['target']); } if (string_replace($old, $new, $item['body'])) { $item['sig'] = base64url_encode(rsa_sign($item['body'], $channel['channel_prvkey'])); $item['item_verified'] = 1; } }
function item_url_replace($channel, &$item, $old, $new, $oldnick = '') { if ($item['attach']) { json_url_replace($old, $new, $item['attach']); if ($oldnick) { json_url_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['attach']); } } if ($item['object']) { json_url_replace($old, $new, $item['object']); if ($oldnick) { json_url_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['object']); } } if ($item['target']) { json_url_replace($old, $new, $item['target']); if ($oldnick) { json_url_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['target']); } } if (string_replace($old, $new, $item['body'])) { $item['sig'] = base64url_encode(rsa_sign($item['body'], $channel['channel_prvkey'])); $item['item_verified'] = 1; } $item['plink'] = str_replace($old, $new, $item['plink']); if ($oldnick) { $item['plink'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['plink']); } $item['llink'] = str_replace($old, $new, $item['llink']); if ($oldnick) { $item['llink'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['llink']); } }