X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=97baee7f60b551a76089ba31efbd66e573bb3412;hb=761bdafa34bfdf1b2b43a3f06ae092e0925898ac;hp=6aa0c9d2dd43208e33464c913d79253b5a04cf4c;hpb=66a103e36a42ab251fd9ca6c4b56b54380e4d535;p=friendica.git diff --git a/include/text.php b/include/text.php index 6aa0c9d2dd..97baee7f60 100644 --- a/include/text.php +++ b/include/text.php @@ -12,17 +12,17 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Protocol; use Friendica\Core\System; -use Friendica\Database\DBM; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Event; use Friendica\Model\Item; -use Friendica\Model\Profile; use Friendica\Render\FriendicaSmarty; use Friendica\Util\DateTimeFormat; use Friendica\Util\Map; +use Friendica\Util\Proxy as ProxyUtils; -require_once "mod/proxy.php"; require_once "include/conversation.php"; /** @@ -513,7 +513,8 @@ $LOGGER_LEVELS = []; * @brief Logs the given message at the given log level * * log levels: - * LOGGER_NORMAL (default) + * LOGGER_WARNING + * LOGGER_INFO (default) * LOGGER_TRACE * LOGGER_DEBUG * LOGGER_DATA @@ -523,7 +524,7 @@ $LOGGER_LEVELS = []; * @param string $msg * @param int $level */ -function logger($msg, $level = 0) { +function logger($msg, $level = LOGGER_INFO) { $a = get_app(); global $LOGGER_LEVELS; @@ -583,7 +584,8 @@ function logger($msg, $level = 0) { * personally without background noise * * log levels: - * LOGGER_NORMAL (default) + * LOGGER_WARNING + * LOGGER_INFO (default) * LOGGER_TRACE * LOGGER_DEBUG * LOGGER_DATA @@ -593,7 +595,7 @@ function logger($msg, $level = 0) { * @param string $msg * @param int $level */ -function dlogger($msg, $level = 0) { +function dlogger($msg, $level = LOGGER_INFO) { $a = get_app(); $logfile = Config::get('system', 'dlogfile'); @@ -754,11 +756,11 @@ function contact_block() { AND NOT `pending` AND NOT `hidden` AND NOT `archive` AND `network` IN ('%s', '%s', '%s')", intval($a->profile['uid']), - dbesc(NETWORK_DFRN), - dbesc(NETWORK_OSTATUS), - dbesc(NETWORK_DIASPORA) + DBA::escape(Protocol::DFRN), + DBA::escape(Protocol::OSTATUS), + DBA::escape(Protocol::DIASPORA) ); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $total = intval($r[0]['total']); } if (!$total) { @@ -772,20 +774,20 @@ function contact_block() { AND `network` IN ('%s', '%s', '%s') ORDER BY RAND() LIMIT %d", intval($a->profile['uid']), - dbesc(NETWORK_DFRN), - dbesc(NETWORK_OSTATUS), - dbesc(NETWORK_DIASPORA), + DBA::escape(Protocol::DFRN), + DBA::escape(Protocol::OSTATUS), + DBA::escape(Protocol::DIASPORA), intval($shown) ); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $contacts = []; foreach ($r AS $contact) { $contacts[] = $contact["id"]; } $r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)", - dbesc(implode(",", $contacts))); + DBA::escape(implode(",", $contacts))); - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { $contacts = L10n::tt('%d Contact', '%d Contacts', $total); $micropro = []; foreach ($r as $rr) { @@ -857,7 +859,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { '$click' => defaults($contact, 'click', ''), '$class' => $class, '$url' => $url, - '$photo' => proxy_url($contact['thumb'], false, PROXY_SIZE_THUMB), + '$photo' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB), '$name' => $contact['name'], 'title' => $contact['name'] . ' [' . $contact['addr'] . ']', '$parkle' => $sparkle, @@ -1038,7 +1040,7 @@ function redir_private_images($a, &$item) continue; } - if ((local_user() == $item['uid']) && ($item['private'] == 1) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == NETWORK_DFRN)) { + if ((local_user() == $item['uid']) && ($item['private'] == 1) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == Protocol::DFRN)) { $img_url = 'redir?f=1&quiet=1&url=' . urlencode($mtch[1]) . '&conurl=' . urlencode($item['author-link']); $item['body'] = str_replace($mtch[0], '[img]' . $img_url . '[/img]', $item['body']); } @@ -1457,26 +1459,6 @@ function return_bytes($size_str) { } } - -/** - * @return string - */ -function generate_user_guid() { - $found = true; - do { - $guid = System::createGUID(32); - $x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1", - dbesc($guid) - ); - if (!DBM::is_result($x)) { - $found = false; - } - } while ($found == true); - - return $guid; -} - - /** * @param string $s * @param boolean $strip_padding @@ -1658,7 +1640,7 @@ function file_tag_file_query($table,$s,$type = 'file') { } else { $str = preg_quote('<' . str_replace('%', '%%', file_tag_encode($s)) . '>'); } - return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' "; + return " AND " . (($table) ? DBA::escape($table) . '.' : '') . "file regexp '" . DBA::escape($str) . "' "; } // ex. given music,video return