if (api_user() === false || $user_info === false) { throw new ForbiddenException(); }
- if (empty($_REQUEST['q'])) { throw new BadRequestException('q parameter is required.'); }
-
+ if (empty($_REQUEST['q'])) {
+ throw new BadRequestException('q parameter is required.');
+ }
+
$searchTerm = trim(rawurldecode($_REQUEST['q']));
$data = [];
if (api_user() === false) {
throw new ForbiddenException();
}
+
// input params
$photo_id = defaults($_REQUEST, 'photo_id', null);
if ($photo_id == null) {
throw new BadRequestException("no photo_id specified");
}
+
// check if photo is existing in database
- $r = Photo::exists(['resource-id' => $photo_id, 'uid' => api_user()]);
- if (!$r) {
+ if (!Photo::exists(['resource-id' => $photo_id, 'uid' => api_user()])) {
throw new BadRequestException("photo not available");
}
+
// now we can perform on the deletion of the photo
$result = Photo::delete(['uid' => api_user(), 'resource-id' => $photo_id]);
$a = Factory\DependencyFactory::setUp('index', __DIR__, false);
$a->runFrontend();
+
$storage_form = [];
if (!is_null($storage_current_backend) && $storage_current_backend != "") {
- foreach($storage_current_backend::getOptions() as $name => $info) {
+ foreach ($storage_current_backend::getOptions() as $name => $info) {
$type = $info[0];
$info[0] = $storage_form_prefix . '_' . $name;
$info['type'] = $type;
namespace Friendica\Model;
use Friendica\Database\DBA;
+use \BadMethodCallException;
class ItemDeliveryData
{
public static function insert($item_id, array $fields)
{
if (empty($item_id)) {
- throw new \BadMethodCallException('Empty item_id');
+ throw new BadMethodCallException('Empty item_id');
}
$fields['iid'] = $item_id;
public static function update($item_id, array $fields)
{
if (empty($item_id)) {
- throw new \BadMethodCallException('Empty item_id');
+ throw new BadMethodCallException('Empty item_id');
}
if (empty($fields)) {
public static function delete($item_id)
{
if (empty($item_id)) {
- throw new \BadMethodCallException('Empty item_id');
+ throw new BadMethodCallException('Empty item_id');
}
return DBA::delete('item-delivery-data', ['iid' => $item_id]);
*/
public static function getImageForPhoto(array $photo)
{
+ $data = "";
+
if ($photo["backend-class"] == "") {
// legacy data storage in "data" column
$i = self::selectFirst(["data"], ["id" => $photo["id"]]);
if ($data === "") {
return null;
}
+
return new Image($data, $photo["type"]);
}
{
$fields = self::getFields();
$values = array_fill(0, count($fields), "");
+
$photo = array_combine($fields, $values);
$photo["backend-class"] = Storage\SystemResource::class;
$photo["backend-ref"] = $filename;
$photo["type"] = $mimetype;
$photo["cacheable"] = false;
+
return $photo;
}
{
return DBA::delete('storage', ['id' => $ref]);
}
-
- public static function getOptions() { return []; }
-
- public static function saveOptions($data) { return []; }
+
+ public static function getOptions()
+ {
+ return [];
+ }
+
+ public static function saveOptions($data)
+ {
+ return [];
+ }
}
namespace Friendica\Model\Storage;
+use \BadMethodCallException;
+
/**
* @brief System resource storage class
*
public static function put($data, $filename = "")
{
- throw new \BadMethodCallException();
+ throw new BadMethodCallException();
}
public static function delete($filename)
{
- throw new \BadMethodCallException();
+ throw new BadMethodCallException();
}
public static function getOptions()
}
DBA::close($delivery_contacts_stmt);
-
$url_recipients = array_filter($url_recipients);
// send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
// They are especially used for notifications to OStatus users that don't follow us.