use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\DI;
+use Friendica\Model\Contact;
use Friendica\Model\Post;
+use Friendica\Model\User;
use Friendica\Network\HTTPException;
use Friendica\Security\BasicAuth;
use Friendica\Security\OAuth;
*/
protected static $request = [];
- public static function delete(array $parameters = [])
+ public function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public static function patch(array $parameters = [])
+ public function patch()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public static function post(array $parameters = [])
+ public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public static function put(array $parameters = [])
+ public function put()
{
self::checkAllowedScope(self::SCOPE_WRITE);
* Set boundaries for the "link" header
* @param array $boundaries
* @param int $id
- * @return array
*/
protected static function setBoundaries(int $id)
{
}
}
}
+
+ public static function getContactIDForSearchterm(string $screen_name = null, int $cid = null, int $uid)
+ {
+ if (!empty($cid)) {
+ return $cid;
+ }
+
+ if (strpos($screen_name, '@') !== false) {
+ $cid = Contact::getIdForURL($screen_name, 0, false);
+ } else {
+ $user = User::getByNickname($screen_name, ['uid']);
+ if (!empty($user['uid'])) {
+ $cid = Contact::getPublicIdByUserId($user['uid']);
+ }
+ }
+
+ if (empty($cid) && ($uid != 0)) {
+ $cid = Contact::getPublicIdByUserId($uid);
+ }
+
+ return $cid;
+ }
}