1
0
Fork 0

Log function

implement log() function.
This commit is contained in:
Adam Magness 2018-10-29 17:20:46 -04:00
commit 14fde5dc9b
122 changed files with 1280 additions and 1161 deletions

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -34,7 +35,7 @@ function acl_content(App $a)
$search = $_REQUEST['query'];
}
logger("Searching for ".$search." - type ".$type." conversation ".$conv_id, LOGGER_DEBUG);
Logger::log("Searching for ".$search." - type ".$type." conversation ".$conv_id, LOGGER_DEBUG);
if ($search != '') {
$sql_extra = "AND `name` LIKE '%%" . DBA::escape($search) . "%%'";

View file

@ -13,6 +13,7 @@ use Friendica\Content\Text\Markdown;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
@ -910,7 +911,7 @@ function admin_page_summary(App $a)
$users+= $u['count'];
}
logger('accounts: ' . print_r($accounts, true), LOGGER_DATA);
Logger::log('accounts: ' . print_r($accounts, true), LOGGER_DATA);
$pending = Register::getPendingCount();
@ -2499,7 +2500,7 @@ function admin_page_features_post(App $a)
{
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');
logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
Logger::log('postvars: ' . print_r($_POST, true), LOGGER_DATA);
$features = Feature::get(false);

View file

@ -6,6 +6,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model;
@ -78,7 +79,7 @@ function crepair_post(App $a)
);
if ($photo) {
logger('mod-crepair: updating photo from ' . $photo);
Logger::log('mod-crepair: updating photo from ' . $photo);
Model\Contact::updateAvatar($photo, local_user(), $contact['id']);
}

View file

@ -20,6 +20,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -76,7 +77,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// These data elements may come from either the friend request notification form or $handsfree array.
if (is_array($handsfree)) {
logger('Confirm in handsfree mode');
Logger::log('Confirm in handsfree mode');
$dfrn_id = $handsfree['dfrn_id'];
$intro_id = $handsfree['intro_id'];
$duplex = $handsfree['duplex'];
@ -99,9 +100,9 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$cid = 0;
}
logger('Confirming request for dfrn_id (issued) ' . $dfrn_id);
Logger::log('Confirming request for dfrn_id (issued) ' . $dfrn_id);
if ($cid) {
logger('Confirming follower with contact_id: ' . $cid);
Logger::log('Confirming follower with contact_id: ' . $cid);
}
/*
@ -124,7 +125,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
intval($uid)
);
if (!DBA::isResult($r)) {
logger('Contact not found in DB.');
Logger::log('Contact not found in DB.');
notice(L10n::t('Contact not found.') . EOL);
notice(L10n::t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL);
return;
@ -211,7 +212,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$params['page'] = 2;
}
logger('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params, true), LOGGER_DATA);
Logger::log('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params, true), LOGGER_DATA);
/*
*
@ -223,7 +224,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();
logger(' Confirm: received data: ' . $res, LOGGER_DATA);
Logger::log(' Confirm: received data: ' . $res, LOGGER_DATA);
// Now figure out what they responded. Try to be robust if the remote site is
// having difficulty and throwing up errors of some kind.
@ -248,7 +249,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
if (stristr($res, "<status") === false) {
// wrong xml! stop here!
logger('Unexpected response posting to ' . $dfrn_confirm);
Logger::log('Unexpected response posting to ' . $dfrn_confirm);
notice(L10n::t('Unexpected response from remote site: ') . EOL . htmlspecialchars($res) . EOL);
return;
}
@ -305,7 +306,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
*/
Contact::updateAvatar($contact['photo'], $uid, $contact_id);
logger('dfrn_confirm: confirm - imported photos');
Logger::log('dfrn_confirm: confirm - imported photos');
if ($network === Protocol::DFRN) {
$new_relation = Contact::FOLLOWER;
@ -387,7 +388,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
if ((isset($new_relation) && $new_relation == Contact::FRIEND)) {
if (DBA::isResult($contact) && ($contact['network'] === Protocol::DIASPORA)) {
$ret = Diaspora::sendShare($user, $contact);
logger('share returns: ' . $ret);
Logger::log('share returns: ' . $ret);
}
}
@ -427,9 +428,9 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$forum = (($page == 1) ? 1 : 0);
$prv = (($page == 2) ? 1 : 0);
logger('dfrn_confirm: requestee contacted: ' . $node);
Logger::log('dfrn_confirm: requestee contacted: ' . $node);
logger('dfrn_confirm: request: POST=' . print_r($_POST, true), LOGGER_DATA);
Logger::log('dfrn_confirm: request: POST=' . print_r($_POST, true), LOGGER_DATA);
// If $aes_key is set, both of these items require unpacking from the hex transport encoding.
@ -542,7 +543,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
Contact::updateAvatar($photo, $local_uid, $dfrn_record);
logger('dfrn_confirm: request - photos imported');
Logger::log('dfrn_confirm: request - photos imported');
$new_relation = Contact::SHARING;
@ -582,7 +583,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// Otherwise everything seems to have worked and we are almost done. Yay!
// Send an email notification
logger('dfrn_confirm: request: info updated');
Logger::log('dfrn_confirm: request: info updated');
$combined = null;
$r = q("SELECT `contact`.*, `user`.*

View file

@ -8,6 +8,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -17,7 +18,7 @@ use Friendica\Protocol\Diaspora;
require_once 'include/items.php';
function dfrn_notify_post(App $a) {
logger(__function__, LOGGER_TRACE);
Logger::log(__function__, LOGGER_TRACE);
$postdata = file_get_contents('php://input');
@ -63,7 +64,7 @@ function dfrn_notify_post(App $a) {
}
if (!DBA::exists('challenge', ['dfrn-id' => $dfrn_id, 'challenge' => $challenge])) {
logger('could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
Logger::log('could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
System::xmlExit(3, 'Could not match challenge');
}
@ -71,7 +72,7 @@ function dfrn_notify_post(App $a) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]);
if (!DBA::isResult($user)) {
logger('User not found for nickname ' . $a->argv[1]);
Logger::log('User not found for nickname ' . $a->argv[1]);
System::xmlExit(3, 'User not found');
}
@ -94,7 +95,7 @@ function dfrn_notify_post(App $a) {
$contact = DBA::selectFirst('contact', ['id'], $condition);
if (!DBA::isResult($contact)) {
logger('contact not found for dfrn_id ' . $dfrn_id);
Logger::log('contact not found for dfrn_id ' . $dfrn_id);
System::xmlExit(3, 'Contact not found');
}
@ -117,12 +118,12 @@ function dfrn_notify_post(App $a) {
$importer = Contact::updateSslPolicy($importer, $ssl_policy);
logger('data: ' . $data, LOGGER_DATA);
Logger::log('data: ' . $data, LOGGER_DATA);
if ($dissolve == 1) {
// Relationship is dissolved permanently
Contact::remove($importer['id']);
logger('relationship dissolved : ' . $importer['name'] . ' dissolved ' . $importer['username']);
Logger::log('relationship dissolved : ' . $importer['name'] . ' dissolved ' . $importer['username']);
System::xmlExit(0, 'relationship dissolved');
}
@ -134,12 +135,12 @@ function dfrn_notify_post(App $a) {
// if local rino is lower than remote rino, abort: should not happen!
// but only for $remote_rino > 1, because old code did't send rino version
if ($rino_remote > 1 && $rino < $rino_remote) {
logger("rino version '$rino_remote' is lower than supported '$rino'");
Logger::log("rino version '$rino_remote' is lower than supported '$rino'");
System::xmlExit(0, "rino version '$rino_remote' is lower than supported '$rino'");
}
$rawkey = hex2bin(trim($key));
logger('rino: md5 raw key: ' . md5($rawkey), LOGGER_DATA);
Logger::log('rino: md5 raw key: ' . md5($rawkey), LOGGER_DATA);
$final_key = '';
@ -165,14 +166,14 @@ function dfrn_notify_post(App $a) {
$data = DFRN::aesDecrypt(hex2bin($data), $final_key);
break;
default:
logger("rino: invalid sent version '$rino_remote'");
Logger::log("rino: invalid sent version '$rino_remote'");
System::xmlExit(0, "Invalid sent version '$rino_remote'");
}
logger('rino: decrypted data: ' . $data, LOGGER_DATA);
Logger::log('rino: decrypted data: ' . $data, LOGGER_DATA);
}
logger('Importing post from ' . $importer['addr'] . ' to ' . $importer['nickname'] . ' with the RINO ' . $rino_remote . ' encryption.', LOGGER_DEBUG);
Logger::log('Importing post from ' . $importer['addr'] . ' to ' . $importer['nickname'] . ' with the RINO ' . $rino_remote . ' encryption.', LOGGER_DEBUG);
$ret = DFRN::import($data, $importer);
System::xmlExit($ret, 'Processed');
@ -191,7 +192,7 @@ function dfrn_dispatch_public($postdata)
// Fetch the corresponding public contact
$contact = Contact::getDetailsByAddr($msg['author'], 0);
if (!$contact) {
logger('Contact not found for address ' . $msg['author']);
Logger::log('Contact not found for address ' . $msg['author']);
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
@ -199,11 +200,11 @@ function dfrn_dispatch_public($postdata)
// This should never fail
if (empty($importer)) {
logger('Contact not found for address ' . $msg['author']);
Logger::log('Contact not found for address ' . $msg['author']);
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
logger('Importing post from ' . $msg['author'] . ' with the public envelope.', LOGGER_DEBUG);
Logger::log('Importing post from ' . $msg['author'] . ' with the public envelope.', LOGGER_DEBUG);
// Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer);
@ -223,7 +224,7 @@ function dfrn_dispatch_private($user, $postdata)
// Otherwise there should be a public contact
$cid = Contact::getIdForURL($msg['author']);
if (!$cid) {
logger('Contact not found for address ' . $msg['author']);
Logger::log('Contact not found for address ' . $msg['author']);
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
}
@ -232,11 +233,11 @@ function dfrn_dispatch_private($user, $postdata)
// This should never fail
if (empty($importer)) {
logger('Contact not found for address ' . $msg['author']);
Logger::log('Contact not found for address ' . $msg['author']);
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
}
logger('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', LOGGER_DEBUG);
Logger::log('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', LOGGER_DEBUG);
// Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer);
@ -258,7 +259,7 @@ function dfrn_notify_content(App $a) {
$type = "";
$last_update = "";
logger('new notification dfrn_id=' . $dfrn_id);
Logger::log('new notification dfrn_id=' . $dfrn_id);
$direction = (-1);
if (strpos($dfrn_id,':') == 1) {
@ -276,11 +277,11 @@ function dfrn_notify_content(App $a) {
'type' => $type, 'last_update' => $last_update];
DBA::insert('challenge', $fields);
logger('challenge=' . $hash, LOGGER_DATA);
Logger::log('challenge=' . $hash, LOGGER_DATA);
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]);
if (!DBA::isResult($user)) {
logger('User not found for nickname ' . $a->argv[1]);
Logger::log('User not found for nickname ' . $a->argv[1]);
killme();
}
@ -305,18 +306,18 @@ function dfrn_notify_content(App $a) {
$contact = DBA::selectFirst('contact', ['id'], $condition);
if (!DBA::isResult($contact)) {
logger('contact not found for dfrn_id ' . $dfrn_id);
Logger::log('contact not found for dfrn_id ' . $dfrn_id);
System::xmlExit(3, 'Contact not found');
}
// $importer in this case contains the contact record for the remote contact joined with the user record of our user.
$importer = DFRN::getImporter($contact['id'], $user['uid']);
if (empty($importer)) {
logger('No importer data found for user ' . $a->argv[1] . ' and contact ' . $dfrn_id);
Logger::log('No importer data found for user ' . $a->argv[1] . ' and contact ' . $dfrn_id);
killme();
}
logger("Remote rino version: ".$rino_remote." for ".$importer["url"], LOGGER_DATA);
Logger::log("Remote rino version: ".$rino_remote." for ".$importer["url"], LOGGER_DATA);
$challenge = '';
$encrypted_id = '';
@ -344,7 +345,7 @@ function dfrn_notify_content(App $a) {
$rino = Config::get('system', 'rino_encrypt');
$rino = intval($rino);
logger("Local rino version: ". $rino, LOGGER_DATA);
Logger::log("Local rino version: ". $rino, LOGGER_DATA);
// if requested rino is lower than enabled local rino, lower local rino version
// if requested rino is higher than enabled local rino, reply with local rino

View file

@ -7,6 +7,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Module\Login;
@ -68,7 +69,7 @@ function dfrn_poll_init(App $a)
$user = $r[0]['nickname'];
}
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user);
Logger::log('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user);
header("Content-type: application/atom+xml");
echo DFRN::feed('', $user, $last_update, 0, $hidewall);
killme();
@ -104,7 +105,7 @@ function dfrn_poll_init(App $a)
if (DBA::isResult($r)) {
$s = Network::fetchUrl($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
Logger::log("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
if (strlen($s)) {
$xml = XML::parseString($s);
@ -191,7 +192,7 @@ function dfrn_poll_init(App $a)
}
if ($final_dfrn_id != $orig_id) {
logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
// did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption');
}
@ -238,7 +239,7 @@ function dfrn_poll_post(App $a)
if ($ptype === 'profile-check') {
if (strlen($challenge) && strlen($sec)) {
logger('dfrn_poll: POST: profile-check');
Logger::log('dfrn_poll: POST: profile-check');
DBA::delete('profile_check', ["`expire` < ?", time()]);
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
@ -283,7 +284,7 @@ function dfrn_poll_post(App $a)
}
if ($final_dfrn_id != $orig_id) {
logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
Logger::log('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
// did not decode properly - cannot trust this site
System::xmlExit(3, 'Bad decryption');
}
@ -372,7 +373,7 @@ function dfrn_poll_post(App $a)
// NOTREACHED
} else {
// Update the writable flag if it changed
logger('dfrn_poll: post request feed: ' . print_r($_POST, true), LOGGER_DATA);
Logger::log('dfrn_poll: post request feed: ' . print_r($_POST, true), LOGGER_DATA);
if ($dfrn_version >= 2.21) {
if ($perm === 'rw') {
$writable = 1;
@ -510,15 +511,15 @@ function dfrn_poll_content(App $a)
])->getBody();
}
logger("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
Logger::log("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
if (strlen($s) && strstr($s, '<?xml')) {
$xml = XML::parseString($s);
logger('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), LOGGER_DATA);
Logger::log('dfrn_poll: profile: parsed xml: ' . print_r($xml, true), LOGGER_DATA);
logger('dfrn_poll: secure profile: challenge: ' . $xml->challenge . ' expecting ' . $hash);
logger('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec);
Logger::log('dfrn_poll: secure profile: challenge: ' . $xml->challenge . ' expecting ' . $hash);
Logger::log('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec);
if (((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) {
$_SESSION['authenticated'] = 1;

View file

@ -15,6 +15,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -57,7 +58,7 @@ function dfrn_request_init(App $a)
function dfrn_request_post(App $a)
{
if (($a->argc != 2) || (!count($a->profile))) {
logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
Logger::log('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
return;
}
@ -297,7 +298,7 @@ function dfrn_request_post(App $a)
$network = Protocol::DFRN;
}
logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
Logger::log('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
if ($network === Protocol::DFRN) {
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",

View file

@ -10,6 +10,7 @@ use Friendica\Content\Text\HTML;
use Friendica\Core\ACL;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -74,7 +75,7 @@ function display_init(App $a)
}
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
logger('Directly serving XML for id '.$item["id"], LOGGER_DEBUG);
Logger::log('Directly serving XML for id '.$item["id"], LOGGER_DEBUG);
displayShowFeed($item["id"], false);
}

View file

@ -9,6 +9,7 @@ use Friendica\Content\Nav;
use Friendica\Content\Widget\CalendarExport;
use Friendica\Core\ACL;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -47,7 +48,7 @@ function events_init(App $a)
function events_post(App $a)
{
logger('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
if (!local_user()) {
return;

View file

@ -4,6 +4,7 @@
*/
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
require_once 'include/items.php';
@ -17,7 +18,7 @@ function filer_content(App $a)
$term = unxmlify(trim(defaults($_GET, 'term', '')));
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
logger('filer: tag ' . $term . ' item ' . $item_id);
Logger::log('filer: tag ' . $term . ' item ' . $item_id);
if ($item_id && strlen($term)) {
// file item

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\System;
function filerm_content(App $a) {
@ -19,7 +20,7 @@ function filerm_content(App $a) {
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
logger('filerm: tag ' . $term . ' item ' . $item_id);
Logger::log('filerm: tag ' . $term . ' item ' . $item_id);
if ($item_id && strlen($term)) {
file_tag_unsave_file(local_user(),$item_id,$term, $category);

View file

@ -22,6 +22,7 @@ use Friendica\Content\Text\HTML;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
@ -56,7 +57,7 @@ function item_post(App $a) {
Addon::callHooks('post_local_start', $_REQUEST);
logger('postvars ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('postvars ' . print_r($_REQUEST, true), LOGGER_DATA);
$api_source = defaults($_REQUEST, 'api_source', false);
@ -72,7 +73,7 @@ function item_post(App $a) {
*/
if (!$preview && !empty($_REQUEST['post_id_random'])) {
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
logger("item post: duplicate post", LOGGER_DEBUG);
Logger::log("item post: duplicate post", LOGGER_DEBUG);
item_post_return(System::baseUrl(), $api_source, $return_path);
} else {
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
@ -130,7 +131,7 @@ function item_post(App $a) {
}
if ($parent) {
logger('mod_item: item_post parent=' . $parent);
Logger::log('mod_item: item_post parent=' . $parent);
}
$post_id = intval(defaults($_REQUEST, 'post_id', 0));
@ -153,7 +154,7 @@ function item_post(App $a) {
// Check for multiple posts with the same message id (when the post was created via API)
if (($message_id != '') && ($profile_uid != 0)) {
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) {
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
Logger::log("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
return 0;
}
}
@ -669,7 +670,7 @@ function item_post(App $a) {
$datarray["author-network"] = Protocol::DFRN;
$o = conversation($a, [array_merge($contact_record, $datarray)], new Pager($a->query_string), 'search', false, true);
logger('preview: ' . $o);
Logger::log('preview: ' . $o);
echo json_encode(['preview' => $o]);
exit();
}
@ -677,7 +678,7 @@ function item_post(App $a) {
Addon::callHooks('post_local',$datarray);
if (!empty($datarray['cancel'])) {
logger('mod_item: post cancelled by addon.');
Logger::log('mod_item: post cancelled by addon.');
if ($return_path) {
$a->internalRedirect($return_path);
}
@ -714,7 +715,7 @@ function item_post(App $a) {
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
if (!empty($_REQUEST['return']) && strlen($return_path)) {
logger('return: ' . $return_path);
Logger::log('return: ' . $return_path);
$a->internalRedirect($return_path);
}
killme();
@ -736,14 +737,14 @@ function item_post(App $a) {
$post_id = Item::insert($datarray);
if (!$post_id) {
logger("Item wasn't stored.");
Logger::log("Item wasn't stored.");
$a->internalRedirect($return_path);
}
$datarray = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
if (!DBA::isResult($datarray)) {
logger("Item with id ".$post_id." couldn't be fetched.");
Logger::log("Item with id ".$post_id." couldn't be fetched.");
$a->internalRedirect($return_path);
}
@ -833,7 +834,7 @@ function item_post(App $a) {
// We don't fork a new process since this is done anyway with the following command
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], "CreateShadowEntry", $post_id);
logger('post_complete');
Logger::log('post_complete');
if ($api_source) {
return $post_id;
@ -861,7 +862,7 @@ function item_post_return($baseurl, $api_source, $return_path)
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
}
logger('post_json: ' . print_r($json, true), LOGGER_DEBUG);
Logger::log('post_json: ' . print_r($json, true), LOGGER_DEBUG);
echo json_encode($json);
killme();

View file

@ -15,6 +15,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
@ -871,7 +872,7 @@ function networkThreadedView(App $a, $update, $parent)
$_SESSION['network_last_date'] = $tag_top_limit;
}
logger('Tagged items: ' . count($data) . ' - ' . $bottom_limit . ' - ' . $top_limit . ' - ' . local_user().' - '.(int)$update);
Logger::log('Tagged items: ' . count($data) . ' - ' . $bottom_limit . ' - ' . $top_limit . ' - ' . local_user().' - '.(int)$update);
$s = [];
foreach ($r as $item) {
$s[$item['uri']] = $item;

View file

@ -8,6 +8,7 @@
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\Network;
@ -172,7 +173,7 @@ function nodeinfo_cron() {
return;
}
logger('cron_start');
Logger::log('cron_start');
$users = q("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item`
FROM `user`
@ -203,22 +204,22 @@ function nodeinfo_cron() {
Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear);
Config::set('nodeinfo', 'active_users_monthly', $active_users_monthly);
logger('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
Logger::log('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
}
$local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_posts', $local_posts);
logger('local_posts: ' . $local_posts, LOGGER_DEBUG);
Logger::log('local_posts: ' . $local_posts, LOGGER_DEBUG);
$local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_comments', $local_comments);
logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
Logger::log('local_comments: ' . $local_comments, LOGGER_DEBUG);
// Now trying to register
$url = 'http://the-federation.info/register/'.$a->getHostName();
logger('registering url: '.$url, LOGGER_DEBUG);
Logger::log('registering url: '.$url, LOGGER_DEBUG);
$ret = Network::fetchUrl($url);
logger('registering answer: '.$ret, LOGGER_DEBUG);
Logger::log('registering answer: '.$ret, LOGGER_DEBUG);
logger('cron_end');
Logger::log('cron_end');
}

View file

@ -7,6 +7,7 @@ use Friendica\App;
use Friendica\Core\Authentication;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -16,7 +17,7 @@ function openid_content(App $a) {
if($noid)
$a->internalRedirect();
logger('mod_openid ' . print_r($_REQUEST,true), LOGGER_DATA);
Logger::log('mod_openid ' . print_r($_REQUEST,true), LOGGER_DATA);
if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
@ -27,7 +28,7 @@ function openid_content(App $a) {
$authid = $_REQUEST['openid_identity'];
if(! strlen($authid)) {
logger(L10n::t('OpenID protocol error. No ID returned.') . EOL);
Logger::log(L10n::t('OpenID protocol error. No ID returned.') . EOL);
$a->internalRedirect();
}

View file

@ -11,6 +11,7 @@
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Logger;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
@ -54,7 +55,7 @@ function parse_url_content(App $a)
}
}
logger($url);
Logger::log($url);
// Check if the URL is an image, video or audio file. If so format
// the URL with the corresponding BBCode media tag
@ -114,7 +115,7 @@ function parse_url_content(App $a)
$result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags;
logger('(unparsed): returns: ' . $result);
Logger::log('(unparsed): returns: ' . $result);
echo $result;
exit();

View file

@ -12,6 +12,7 @@ use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -141,9 +142,9 @@ function photos_init(App $a) {
function photos_post(App $a)
{
logger('mod-photos: photos_post: begin' , LOGGER_DEBUG);
logger('mod_photos: REQUEST ' . print_r($_REQUEST, true), LOGGER_DATA);
logger('mod_photos: FILES ' . print_r($_FILES, true), LOGGER_DATA);
Logger::log('mod-photos: photos_post: begin' , LOGGER_DEBUG);
Logger::log('mod_photos: REQUEST ' . print_r($_REQUEST, true), LOGGER_DATA);
Logger::log('mod_photos: FILES ' . print_r($_FILES, true), LOGGER_DATA);
$phototypes = Image::supportedTypes();
@ -189,7 +190,7 @@ function photos_post(App $a)
if (!$owner_record) {
notice(L10n::t('Contact information unavailable') . EOL);
logger('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
Logger::log('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
killme();
}
@ -379,7 +380,7 @@ function photos_post(App $a)
}
if (!empty($_POST['rotate']) && (intval($_POST['rotate']) == 1 || intval($_POST['rotate']) == 2)) {
logger('rotate');
Logger::log('rotate');
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 0 LIMIT 1",
DBA::escape($resource_id),
@ -706,7 +707,7 @@ function photos_post(App $a)
$album = !empty($_REQUEST['album']) ? notags(trim($_REQUEST['album'])) : '';
$newalbum = !empty($_REQUEST['newalbum']) ? notags(trim($_REQUEST['newalbum'])) : '';
logger('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , LOGGER_DEBUG);
if (!strlen($album)) {
if (strlen($newalbum)) {
@ -799,7 +800,7 @@ function photos_post(App $a)
$type = Image::guessType($filename);
}
logger('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
Logger::log('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
$maximagesize = Config::get('system', 'maximagesize');
@ -819,14 +820,14 @@ function photos_post(App $a)
return;
}
logger('mod/photos.php: photos_post(): loading the contents of ' . $src , LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): loading the contents of ' . $src , LOGGER_DEBUG);
$imagedata = @file_get_contents($src);
$image = new Image($imagedata, $type);
if (!$image->isValid()) {
logger('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
notice(L10n::t('Unable to process image.') . EOL);
@unlink($src);
$foo = 0;
@ -855,7 +856,7 @@ function photos_post(App $a)
$r = Photo::store($image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
if (!$r) {
logger('mod/photos.php: photos_post(): image store failed', LOGGER_DEBUG);
Logger::log('mod/photos.php: photos_post(): image store failed', LOGGER_DEBUG);
notice(L10n::t('Image upload failed.') . EOL);
killme();
}

View file

@ -8,6 +8,7 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -121,7 +122,7 @@ function poco_init(App $a) {
$itemsPerPage = ((x($_GET, 'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
if ($global) {
logger("Start global query", LOGGER_DEBUG);
Logger::log("Start global query", LOGGER_DEBUG);
$contacts = q("SELECT * FROM `gcontact` WHERE `updated` > '%s' AND NOT `hide` AND `network` IN ('%s', '%s', '%s') AND `updated` > `last_failure`
ORDER BY `updated` DESC LIMIT %d, %d",
DBA::escape($update_limit),
@ -132,7 +133,7 @@ function poco_init(App $a) {
intval($itemsPerPage)
);
} elseif ($system_mode) {
logger("Start system mode query", LOGGER_DEBUG);
Logger::log("Start system mode query", LOGGER_DEBUG);
$contacts = q("SELECT `contact`.*, `profile`.`about` AS `pabout`, `profile`.`locality` AS `plocation`, `profile`.`pub_keywords`,
`profile`.`gender` AS `pgender`, `profile`.`address` AS `paddress`, `profile`.`region` AS `pregion`,
`profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type`
@ -144,7 +145,7 @@ function poco_init(App $a) {
intval($itemsPerPage)
);
} else {
logger("Start query for user " . $user['nickname'], LOGGER_DEBUG);
Logger::log("Start query for user " . $user['nickname'], LOGGER_DEBUG);
$contacts = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`)
AND `network` IN ('%s', '%s', '%s', '%s') $sql_extra LIMIT %d, %d",
@ -157,7 +158,7 @@ function poco_init(App $a) {
intval($itemsPerPage)
);
}
logger("Query done", LOGGER_DEBUG);
Logger::log("Query done", LOGGER_DEBUG);
$ret = [];
if (x($_GET, 'sorted')) {
@ -369,7 +370,7 @@ function poco_init(App $a) {
} else {
System::httpExit(500);
}
logger("End of poco", LOGGER_DEBUG);
Logger::log("End of poco", LOGGER_DEBUG);
if ($format === 'xml') {
header('Content-type: text/xml');

View file

@ -16,6 +16,7 @@
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -53,7 +54,7 @@ function poke_init(App $a)
$parent = (x($_GET,'parent') ? intval($_GET['parent']) : 0);
logger('poke: verb ' . $verb . ' contact ' . $contact_id, LOGGER_DEBUG);
Logger::log('poke: verb ' . $verb . ' contact ' . $contact_id, LOGGER_DEBUG);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@ -62,7 +63,7 @@ function poke_init(App $a)
);
if (!DBA::isResult($r)) {
logger('poke: no contact ' . $contact_id);
Logger::log('poke: no contact ' . $contact_id);
return;
}

View file

@ -11,6 +11,7 @@ use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -37,7 +38,7 @@ function profile_init(App $a)
if (DBA::isResult($r)) {
$a->internalRedirect('profile/' . $r[0]['nickname']);
} else {
logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
Logger::log('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
notice(L10n::t('Requested profile is not available.') . EOL);
$a->error = 404;
return;

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -39,14 +40,14 @@ function pubsub_init(App $a)
$hub_lease = notags(trim(defaults($_GET, 'hub_lease_seconds', '')));
$hub_verify = notags(trim(defaults($_GET, 'hub_verify_token', '')));
logger('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
logger('Data: ' . print_r($_GET,true), LOGGER_DATA);
Logger::log('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
Logger::log('Data: ' . print_r($_GET,true), LOGGER_DATA);
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
$owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (!DBA::isResult($owner)) {
logger('Local account not found: ' . $nick);
Logger::log('Local account not found: ' . $nick);
hub_return(false, '');
}
@ -58,12 +59,12 @@ function pubsub_init(App $a)
$contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
if (!DBA::isResult($contact)) {
logger('Contact ' . $contact_id . ' not found.');
Logger::log('Contact ' . $contact_id . ' not found.');
hub_return(false, '');
}
if (!empty($hub_topic) && !link_compare($hub_topic, $contact['poll'])) {
logger('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
hub_return(false, '');
}
@ -71,13 +72,13 @@ function pubsub_init(App $a)
// Don't allow outsiders to unsubscribe us.
if (($hub_mode === 'unsubscribe') && empty($hub_verify)) {
logger('Bogus unsubscribe');
Logger::log('Bogus unsubscribe');
hub_return(false, '');
}
if (!empty($hub_mode)) {
DBA::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]);
logger($hub_mode . ' success for contact ' . $contact_id . '.');
Logger::log($hub_mode . ' success for contact ' . $contact_id . '.');
}
hub_return(true, $hub_challenge);
}
@ -87,8 +88,8 @@ function pubsub_post(App $a)
{
$xml = file_get_contents('php://input');
logger('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
logger('Data: ' . $xml, LOGGER_DATA);
Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
Logger::log('Data: ' . $xml, LOGGER_DATA);
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
@ -106,16 +107,16 @@ function pubsub_post(App $a)
if (!empty($author['contact-id'])) {
$condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
$contact = DBA::selectFirst('contact', [], $condition);
logger('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
Logger::log('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
}
if (!DBA::isResult($contact)) {
logger('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
Logger::log('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
hub_post_return();
}
}
if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != Protocol::FEED)) {
logger('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
Logger::log('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
hub_post_return();
}
@ -125,7 +126,7 @@ function pubsub_post(App $a)
hub_post_return();
}
logger('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')');
Logger::log('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')');
$feedhub = '';
consume_feed($xml, $importer, $contact, $feedhub);

View file

@ -2,6 +2,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\PushSubscriber;
@ -42,11 +43,11 @@ function pubsubhubbub_init(App $a) {
} elseif ($hub_mode === 'unsubscribe') {
$subscribe = 0;
} else {
logger("Invalid hub_mode=$hub_mode, ignoring.");
Logger::log("Invalid hub_mode=$hub_mode, ignoring.");
System::httpExit(404);
}
logger("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
Logger::log("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
// get the nick name from the topic, a bit hacky but needed as a fallback
$nick = substr(strrchr($hub_topic, "/"), 1);
@ -57,7 +58,7 @@ function pubsubhubbub_init(App $a) {
}
if (!$nick) {
logger('Bad hub_topic=$hub_topic, ignoring.');
Logger::log('Bad hub_topic=$hub_topic, ignoring.');
System::httpExit(404);
}
@ -65,13 +66,13 @@ function pubsubhubbub_init(App $a) {
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
$owner = DBA::selectFirst('user', ['uid', 'hidewall'], $condition);
if (!DBA::isResult($owner)) {
logger('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
Logger::log('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
System::httpExit(404);
}
// abort if user's wall is supposed to be private
if ($owner['hidewall']) {
logger('Local user ' . $nick . 'has chosen to hide wall, ignoring.');
Logger::log('Local user ' . $nick . 'has chosen to hide wall, ignoring.');
System::httpExit(403);
}
@ -80,14 +81,14 @@ function pubsubhubbub_init(App $a) {
'pending' => false, 'self' => true];
$contact = DBA::selectFirst('contact', ['poll'], $condition);
if (!DBA::isResult($contact)) {
logger('Self contact for user ' . $owner['uid'] . ' not found.');
Logger::log('Self contact for user ' . $owner['uid'] . ' not found.');
System::httpExit(404);
}
// sanity check that topic URLs are the same
$hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic);
if (!link_compare($hub_topic, $contact['poll']) && !link_compare($hub_topic2, $contact['poll'])) {
logger('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
System::httpExit(404);
}
@ -110,14 +111,14 @@ function pubsubhubbub_init(App $a) {
// give up if the HTTP return code wasn't a success (2xx)
if ($ret < 200 || $ret > 299) {
logger("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
Logger::log("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
System::httpExit(404);
}
// check that the correct hub_challenge code was echoed back
if (trim($body) !== $hub_challenge) {
logger("Subscriber did not echo back hub.challenge, ignoring.");
logger("\"$hub_challenge\" != \"".trim($body)."\"");
Logger::log("Subscriber did not echo back hub.challenge, ignoring.");
Logger::log("\"$hub_challenge\" != \"".trim($body)."\"");
System::httpExit(404);
}

View file

@ -6,6 +6,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Protocol\Diaspora;
@ -18,7 +19,7 @@ function receive_post(App $a)
{
$enabled = intval(Config::get('system', 'diaspora_enabled'));
if (!$enabled) {
logger('mod-diaspora: disabled');
Logger::log('mod-diaspora: disabled');
System::httpExit(500);
}
@ -41,7 +42,7 @@ function receive_post(App $a)
// It is an application/x-www-form-urlencoded
logger('mod-diaspora: receiving post', LOGGER_DEBUG);
Logger::log('mod-diaspora: receiving post', LOGGER_DEBUG);
if (empty($_POST['xml'])) {
$postdata = file_get_contents("php://input");
@ -49,29 +50,29 @@ function receive_post(App $a)
System::httpExit(500);
}
logger('mod-diaspora: message is in the new format', LOGGER_DEBUG);
Logger::log('mod-diaspora: message is in the new format', LOGGER_DEBUG);
$msg = Diaspora::decodeRaw($importer, $postdata);
} else {
$xml = urldecode($_POST['xml']);
logger('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
Logger::log('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
$msg = Diaspora::decode($importer, $xml);
if ($public && !$msg) {
logger('mod-diaspora: decode message in the new format', LOGGER_DEBUG);
Logger::log('mod-diaspora: decode message in the new format', LOGGER_DEBUG);
$msg = Diaspora::decodeRaw($importer, $xml);
}
}
logger('mod-diaspora: decoded', LOGGER_DEBUG);
Logger::log('mod-diaspora: decoded', LOGGER_DEBUG);
logger('mod-diaspora: decoded msg: ' . print_r($msg, true), LOGGER_DATA);
Logger::log('mod-diaspora: decoded msg: ' . print_r($msg, true), LOGGER_DATA);
if (!is_array($msg)) {
System::httpExit(500);
}
logger('mod-diaspora: dispatching', LOGGER_DEBUG);
Logger::log('mod-diaspora: dispatching', LOGGER_DEBUG);
$ret = true;
if ($public) {

View file

@ -2,6 +2,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -51,7 +52,7 @@ function redir_init(App $a) {
if (!empty($a->contact['id']) && $a->contact['id'] == $cid) {
// Local user is already authenticated.
$target_url = defaults($url, $contact_url);
logger($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
$a->redirect($target_url);
}
}
@ -72,7 +73,7 @@ function redir_init(App $a) {
if ($v['uid'] == $_SESSION['visitor_visiting'] && $v['cid'] == $_SESSION['visitor_id']) {
// Remote user is already authenticated.
$target_url = defaults($url, $contact_url);
logger($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
$a->redirect($target_url);
}
}
@ -98,7 +99,7 @@ function redir_init(App $a) {
'sec' => $sec, 'expire' => time() + 45];
DBA::insert('profile_check', $fields);
logger('mod_redir: ' . $contact['name'] . ' ' . $sec, LOGGER_DEBUG);
Logger::log('mod_redir: ' . $contact['name'] . ' ' . $sec, LOGGER_DEBUG);
$dest = (!empty($url) ? '&destination_url=' . $url : '');
@ -120,7 +121,7 @@ function redir_init(App $a) {
$url .= $separator . 'zrl=' . urlencode($my_profile);
}
logger('redirecting to ' . $url, LOGGER_DEBUG);
Logger::log('redirecting to ' . $url, LOGGER_DEBUG);
$a->redirect($url);
}

View file

@ -9,6 +9,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
@ -186,7 +187,7 @@ function register_content(App $a)
if ($max_dailies) {
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
if ($r && $r[0]['total'] >= $max_dailies) {
logger('max daily registrations exceeded.');
Logger::log('max daily registrations exceeded.');
notice(L10n::t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
return;
}

View file

@ -3,6 +3,7 @@
* @file mod/salmon.php
*/
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\System;
@ -20,7 +21,7 @@ function salmon_post(App $a, $xml = '') {
$xml = file_get_contents('php://input');
}
logger('new salmon ' . $xml, LOGGER_DATA);
Logger::log('new salmon ' . $xml, LOGGER_DATA);
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false);
@ -49,7 +50,7 @@ function salmon_post(App $a, $xml = '') {
$base = $dom;
if (empty($base)) {
logger('unable to locate salmon data in xml ');
Logger::log('unable to locate salmon data in xml ');
System::httpExit(400);
}
@ -87,18 +88,18 @@ function salmon_post(App $a, $xml = '') {
$author_link = $author["author-link"];
if(! $author_link) {
logger('Could not retrieve author URI.');
Logger::log('Could not retrieve author URI.');
System::httpExit(400);
}
// Once we have the author URI, go to the web and try to find their public key
logger('Fetching key for ' . $author_link);
Logger::log('Fetching key for ' . $author_link);
$key = Salmon::getKey($author_link, $keyhash);
if(! $key) {
logger('Could not retrieve author key.');
Logger::log('Could not retrieve author key.');
System::httpExit(400);
}
@ -107,7 +108,7 @@ function salmon_post(App $a, $xml = '') {
$m = base64url_decode($key_info[1]);
$e = base64url_decode($key_info[2]);
logger('key details: ' . print_r($key_info,true), LOGGER_DEBUG);
Logger::log('key details: ' . print_r($key_info,true), LOGGER_DEBUG);
$pubkey = Crypto::meToPem($m, $e);
@ -118,23 +119,23 @@ function salmon_post(App $a, $xml = '') {
$mode = 1;
if (! $verify) {
logger('message did not verify using protocol. Trying compliant format.');
Logger::log('message did not verify using protocol. Trying compliant format.');
$verify = Crypto::rsaVerify($compliant_format, $signature, $pubkey);
$mode = 2;
}
if (! $verify) {
logger('message did not verify using padding. Trying old statusnet format.');
Logger::log('message did not verify using padding. Trying old statusnet format.');
$verify = Crypto::rsaVerify($stnet_signed_data, $signature, $pubkey);
$mode = 3;
}
if (! $verify) {
logger('Message did not verify. Discarding.');
Logger::log('Message did not verify. Discarding.');
System::httpExit(400);
}
logger('Message verified with mode '.$mode);
Logger::log('Message verified with mode '.$mode);
/*
@ -155,7 +156,7 @@ function salmon_post(App $a, $xml = '') {
);
if (!DBA::isResult($r)) {
logger('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.');
Logger::log('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.');
if (PConfig::get($importer['uid'], 'system', 'ostatus_autofriend')) {
$result = Contact::createFromProbe($importer['uid'], $author_link);
@ -177,7 +178,7 @@ function salmon_post(App $a, $xml = '') {
//if((DBA::isResult($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == Contact::FOLLOWER) || ($r[0]['blocked']))) {
if (DBA::isResult($r) && $r[0]['blocked']) {
logger('Ignoring this author.');
Logger::log('Ignoring this author.');
System::httpExit(202);
// NOTREACHED
}

View file

@ -10,6 +10,7 @@ use Friendica\Content\Pager;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Item;
@ -204,7 +205,7 @@ function search_content(App $a) {
$pager = new Pager($a->query_string);
if ($tag) {
logger("Start tag search for '".$search."'", LOGGER_DEBUG);
Logger::log("Start tag search for '".$search."'", LOGGER_DEBUG);
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `otype` = ? AND `type` = ? AND `term` = ?",
@ -227,7 +228,7 @@ function search_content(App $a) {
$r = [];
}
} else {
logger("Start fulltext search for '".$search."'", LOGGER_DEBUG);
Logger::log("Start fulltext search for '".$search."'", LOGGER_DEBUG);
$condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
AND `body` LIKE CONCAT('%',?,'%')",
@ -254,12 +255,12 @@ function search_content(App $a) {
'$title' => $title
]);
logger("Start Conversation for '".$search."'", LOGGER_DEBUG);
Logger::log("Start Conversation for '".$search."'", LOGGER_DEBUG);
$o .= conversation($a, $r, $pager, 'search', false, false, 'commented', local_user());
$o .= $pager->renderMinimal(count($r));
logger("Done '".$search."'", LOGGER_DEBUG);
Logger::log("Done '".$search."'", LOGGER_DEBUG);
return $o;
}

View file

@ -11,6 +11,7 @@ use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Theme;
@ -269,7 +270,7 @@ function settings_post(App $a)
intval($mail_pubmail),
intval(local_user())
);
logger("mail: updating mailaccount. Response: ".print_r($r, true));
Logger::log("mail: updating mailaccount. Response: ".print_r($r, true));
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
);
@ -547,7 +548,7 @@ function settings_post(App $a)
// If openid has changed or if there's an openid but no openidserver, try and discover it.
if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
if (Network::isUrlValid($openid)) {
logger('updating openidserver');
Logger::log('updating openidserver');
$open_id_obj = new LightOpenID($a->getHostName());
$open_id_obj->identity = $openid;
$openidserver = $open_id_obj->discover($open_id_obj->identity);

View file

@ -7,6 +7,7 @@
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\System;
function statistics_json_init(App $a) {
@ -56,6 +57,6 @@ function statistics_json_init(App $a) {
header("Content-Type: application/json");
echo json_encode($statistics, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
logger("statistics_init: printed " . print_r($statistics, true), LOGGER_DATA);
Logger::log("statistics_init: printed " . print_r($statistics, true), LOGGER_DATA);
killme();
}

View file

@ -5,6 +5,7 @@
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Item;
@ -26,7 +27,7 @@ function subthread_content(App $a) {
$item = Item::selectFirst([], $condition);
if (empty($item_id) || !DBA::isResult($item)) {
logger('subthread: no item ' . $item_id);
Logger::log('subthread: no item ' . $item_id);
return;
}
@ -62,7 +63,7 @@ function subthread_content(App $a) {
}
if (!$owner) {
logger('like: no owner');
Logger::log('like: no owner');
return;
}

View file

@ -5,6 +5,7 @@
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -28,13 +29,13 @@ function tagger_content(App $a) {
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
logger('tagger: tag ' . $term . ' item ' . $item_id);
Logger::log('tagger: tag ' . $term . ' item ' . $item_id);
$item = Item::selectFirst([], ['id' => $item_id]);
if (!$item_id || !DBA::isResult($item)) {
logger('tagger: no item ' . $item_id);
Logger::log('tagger: no item ' . $item_id);
return;
}
@ -60,7 +61,7 @@ function tagger_content(App $a) {
if (DBA::isResult($r)) {
$contact = $r[0];
} else {
logger('tagger: no contact_id');
Logger::log('tagger: no contact_id');
return;
}

View file

@ -7,6 +7,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\UserImport;
function uimport_post(App $a)
@ -33,7 +34,7 @@ function uimport_content(App $a)
if ($max_dailies) {
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
if ($r && $r[0]['total'] >= $max_dailies) {
logger('max daily registrations exceeded.');
Logger::log('max daily registrations exceeded.');
notice(L10n::t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
return;
}

View file

@ -10,6 +10,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Database\DBA;
@ -19,7 +20,7 @@ use Friendica\Object\Image;
function wall_upload_post(App $a, $desktopmode = true)
{
logger("wall upload: starting new upload", LOGGER_DEBUG);
Logger::log("wall upload: starting new upload", LOGGER_DEBUG);
$r_json = (x($_GET, 'response') && $_GET['response'] == 'json');
$album = (x($_GET, 'album') ? notags(trim($_GET['album'])) : '');
@ -186,7 +187,7 @@ function wall_upload_post(App $a, $desktopmode = true)
$filetype = $imagedata['mime'];
}
logger("File upload src: " . $src . " - filename: " . $filename .
Logger::log("File upload src: " . $src . " - filename: " . $filename .
" - size: " . $filesize . " - type: " . $filetype, LOGGER_DEBUG);
$maximagesize = Config::get('system', 'maximagesize');
@ -225,7 +226,7 @@ function wall_upload_post(App $a, $desktopmode = true)
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
logger("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
Logger::log("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
}
$width = $Image->getWidth();
@ -300,11 +301,11 @@ function wall_upload_post(App $a, $desktopmode = true)
echo json_encode(['picture' => $picture]);
killme();
}
logger("upload done", LOGGER_DEBUG);
Logger::log("upload done", LOGGER_DEBUG);
return $picture;
}
logger("upload done", LOGGER_DEBUG);
Logger::log("upload done", LOGGER_DEBUG);
if ($r_json) {
echo json_encode(['ok' => true]);

View file

@ -4,6 +4,7 @@
*/
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Mail;
@ -30,7 +31,7 @@ function wallmessage_post(App $a) {
);
if (! DBA::isResult($r)) {
logger('wallmessage: no recipient');
Logger::log('wallmessage: no recipient');
return;
}
@ -93,7 +94,7 @@ function wallmessage_content(App $a) {
if (! DBA::isResult($r)) {
notice(L10n::t('No recipient.') . EOL);
logger('wallmessage: no recipient');
Logger::log('wallmessage: no recipient');
return;
}

View file

@ -5,6 +5,7 @@
*/
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
@ -33,7 +34,7 @@ function worker_init()
Worker::startProcess();
logger("Front end worker started: ".getmypid());
Logger::log("Front end worker started: ".getmypid());
Worker::callWorker();
@ -55,7 +56,7 @@ function worker_init()
Worker::endProcess();
logger("Front end worker ended: ".getmypid());
Logger::log("Front end worker ended: ".getmypid());
killme();
}