$a = DI::app();
if (api_user() === false) {
- Logger::log('api_statuses_update: no user');
+ logger::notice('api_statuses_update: no user');
throw new ForbiddenException();
}
$user_info = api_get_user($a);
$a = DI::app();
if (api_user() === false) {
- Logger::log('api_statuses_update: no user');
+ logger::notice('api_statuses_update: no user');
throw new ForbiddenException();
}
$posts_day = Post::count($condition);
if ($posts_day > $throttle_day) {
- Logger::log('Daily posting limit reached for user '.api_user(), Logger::DEBUG);
+ logger::info('Daily posting limit reached for user '.api_user());
// die(api_error($type, DI::l10n()->t("Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
throw new TooManyRequestsException(DI::l10n()->tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
}
$posts_week = Post::count($condition);
if ($posts_week > $throttle_week) {
- Logger::log('Weekly posting limit reached for user '.api_user(), Logger::DEBUG);
+ logger::info('Weekly posting limit reached for user '.api_user());
// die(api_error($type, DI::l10n()->t("Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week)));
throw new TooManyRequestsException(DI::l10n()->tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week));
}
$posts_month = Post::count($condition);
if ($posts_month > $throttle_month) {
- Logger::log('Monthly posting limit reached for user '.api_user(), Logger::DEBUG);
+ logger::info('Monthly posting limit reached for user '.api_user());
// die(api_error($type, DI::l10n()->t("Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
throw new TooManyRequestsException(DI::l10n()->t("Monthly posting limit of %d post reached. The post was rejected.", "Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
}
$a = DI::app();
if (api_user() === false) {
- Logger::log('no user');
+ logger::notice('no user');
throw new ForbiddenException();
}
$id = intval(DI::args()->getArgv()[4] ?? 0);
}
- Logger::log('API: api_statuses_show: ' . $id);
+ logger::notice('API: api_statuses_show: ' . $id);
$conversation = !empty($_REQUEST['conversation']);
$id = intval(DI::args()->getArgv()[4] ?? 0);
}
- Logger::log('API: api_statuses_repeat: '.$id);
+ logger::notice('API: api_statuses_repeat: '.$id);
$fields = ['uri-id', 'network', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
$item = Post::selectFirst($fields, ['id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
$id = intval(DI::args()->getArgv()[4] ?? 0);
}
- Logger::log('API: api_statuses_destroy: '.$id);
+ logger::notice('API: api_statuses_destroy: '.$id);
$ret = api_statuses_show($type);
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
- Logger::log(
+ logger::info(
"File upload src: " . $src . " - filename: " . $filename .
- " - size: " . $filesize . " - type: " . $filetype,
- Logger::DEBUG
- );
+ " - size: " . $filesize . " - type: " . $filetype);
// check if there was a php upload error
if ($filesize == 0 && $media['error'] == 1) {
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
- Logger::log("File upload: Scaling picture to new size " . $max_length, Logger::DEBUG);
+ logger::info("File upload: Scaling picture to new size " . $max_length);
}
$width = $Image->getWidth();
$height = $Image->getHeight();
if ($mediatype == "photo") {
// upload normal image (scales 0, 1, 2)
- Logger::log("photo upload: starting new photo upload", Logger::DEBUG);
+ logger::info("photo upload: starting new photo upload");
$r = Photo::store($Image, local_user(), $visitor, $resource_id, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
- Logger::log("photo upload: image upload with scale 0 (original size) failed");
+ logger::notice("photo upload: image upload with scale 0 (original size) failed");
}
if ($width > 640 || $height > 640) {
$Image->scaleDown(640);
$r = Photo::store($Image, local_user(), $visitor, $resource_id, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
- Logger::log("photo upload: image upload with scale 1 (640x640) failed");
+ logger::notice("photo upload: image upload with scale 1 (640x640) failed");
}
}
$Image->scaleDown(320);
$r = Photo::store($Image, local_user(), $visitor, $resource_id, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
- Logger::log("photo upload: image upload with scale 2 (320x320) failed");
+ logger::notice("photo upload: image upload with scale 2 (320x320) failed");
}
}
- Logger::log("photo upload: new photo upload ended", Logger::DEBUG);
+ logger::info("photo upload: new photo upload ended");
} elseif ($mediatype == "profileimage") {
// upload profile image (scales 4, 5, 6)
- Logger::log("photo upload: starting new profile image upload", Logger::DEBUG);
+ logger::info("photo upload: starting new profile image upload");
if ($width > 300 || $height > 300) {
$Image->scaleDown(300);
$r = Photo::store($Image, local_user(), $visitor, $resource_id, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
- Logger::log("photo upload: profile image upload with scale 4 (300x300) failed");
+ logger::notice("photo upload: profile image upload with scale 4 (300x300) failed");
}
}
$Image->scaleDown(80);
$r = Photo::store($Image, local_user(), $visitor, $resource_id, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
- Logger::log("photo upload: profile image upload with scale 5 (80x80) failed");
+ logger::notice("photo upload: profile image upload with scale 5 (80x80) failed");
}
}
$Image->scaleDown(48);
$r = Photo::store($Image, local_user(), $visitor, $resource_id, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
- Logger::log("photo upload: profile image upload with scale 6 (48x48) failed");
+ logger::notice("photo upload: profile image upload with scale 6 (48x48) failed");
}
}
$Image->__destruct();
- Logger::log("photo upload: new profile image upload ended", Logger::DEBUG);
+ logger::info("photo upload: new profile image upload ended");
}
if (!empty($r)) {
$intros = $intros1 + $intros2;
$myurl = DI::baseUrl() . '/profile/' . $a->getLoggedInUserNickname();
- $mails = q(
- "SELECT `id`, `from-name`, `from-url`, `from-photo`, `created` FROM `mail`
- WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
- intval(local_user()),
- DBA::escape($myurl)
- );
- $mail_count = count($mails);
+ $mail_count = DBA::count('mail', ["`uid` = ? AND NOT `seen` AND `from-url` != ?", local_user(), $myurl]);
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::APPROVE && is_site_admin()) {
$regs = Friendica\Model\Register::getPending();
$cachekey = "ping_init:".local_user();
$ev = DI::cache()->get($cachekey);
if (is_null($ev)) {
- $ev = q(
- "SELECT type, start, adjust FROM `event`
- WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0
- ORDER BY `start` ASC ",
- intval(local_user()),
- DBA::escape(DateTimeFormat::utc('now + 7 days')),
- DBA::escape(DateTimeFormat::utcNow())
- );
+ $ev = DBA::selectToArray('event', ['type', 'start', 'adjust'],
+ ["`uid` = ? AND `start` < ? AND `finish` > ? AND NOT `ignore`",
+ local_user(), DateTimeFormat::utc('now + 7 days'), DateTimeFormat::utcNow()]);
if (DBA::isResult($ev)) {
DI::cache()->set($cachekey, $ev, Duration::HOUR);
}
$notification["name"] = strip_tags(BBCode::convert($notification["name"]));
$notification["message"] = \Friendica\Navigation\Notifications\Entity\Notify::formatMessage($notification["name"], BBCode::toPlaintext($notification["msg"]));
- q(
- "UPDATE `notify` SET `name_cache` = '%s', `msg_cache` = '%s' WHERE `id` = %d",
- DBA::escape($notification["name"]),
- DBA::escape($notification["message"]),
- intval($notification["id"])
- );
+ // @todo Replace this with a call of the Notify model class
+ DBA::update('notify', ['name_cache' => $notification["name"], 'msg_cache' => $notification["message"]], ['id' => $notification["id"]]);
}
$notification["href"] = DI::baseUrl() . "/notification/" . $notification["id"];