mirror of
https://github.com/friendica/friendica
synced 2024-12-23 17:20:16 +00:00
Merge remote-tracking branch 'upstream/develop' into diasppora-delivery
This commit is contained in:
commit
bd97215147
239 changed files with 41733 additions and 40260 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
|
@ -97,7 +98,7 @@ if ($mode == "stop") {
|
|||
|
||||
unlink($pidfile);
|
||||
|
||||
logger("Worker daemon process $pid was killed.", LOGGER_DEBUG);
|
||||
Logger::log("Worker daemon process $pid was killed.", Logger::DEBUG);
|
||||
|
||||
Config::set('system', 'worker_daemon_mode', false);
|
||||
die("Worker daemon process $pid was killed.\n");
|
||||
|
@ -107,7 +108,7 @@ if (!empty($pid) && posix_kill($pid, 0)) {
|
|||
die("Daemon process $pid is already running.\n");
|
||||
}
|
||||
|
||||
logger('Starting worker daemon.', LOGGER_DEBUG);
|
||||
Logger::log('Starting worker daemon.', Logger::DEBUG);
|
||||
|
||||
if (!$foreground) {
|
||||
echo "Starting worker daemon.\n";
|
||||
|
@ -155,7 +156,7 @@ $last_cron = 0;
|
|||
// Now running as a daemon.
|
||||
while (true) {
|
||||
if (!$do_cron && ($last_cron + $wait_interval) < time()) {
|
||||
logger('Forcing cron worker call.', LOGGER_DEBUG);
|
||||
Logger::log('Forcing cron worker call.', Logger::DEBUG);
|
||||
$do_cron = true;
|
||||
}
|
||||
|
||||
|
@ -169,7 +170,7 @@ while (true) {
|
|||
$last_cron = time();
|
||||
}
|
||||
|
||||
logger("Sleeping", LOGGER_DEBUG);
|
||||
Logger::log("Sleeping", Logger::DEBUG);
|
||||
$start = time();
|
||||
do {
|
||||
$seconds = (time() - $start);
|
||||
|
@ -186,10 +187,10 @@ while (true) {
|
|||
|
||||
if ($timeout) {
|
||||
$do_cron = true;
|
||||
logger("Woke up after $wait_interval seconds.", LOGGER_DEBUG);
|
||||
Logger::log("Woke up after $wait_interval seconds.", Logger::DEBUG);
|
||||
} else {
|
||||
$do_cron = false;
|
||||
logger("Worker jobs are calling to be forked.", LOGGER_DEBUG);
|
||||
Logger::log("Worker jobs are calling to be forked.", Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Core\Update;
|
||||
|
||||
// Get options
|
||||
$shortopts = 'sn';
|
||||
|
@ -30,7 +31,7 @@ require_once "boot.php";
|
|||
$a = new App(dirname(__DIR__));
|
||||
|
||||
// Check the database structure and possibly fixes it
|
||||
check_db(true);
|
||||
Update::check(true);
|
||||
|
||||
// Quit when in maintenance
|
||||
if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||
|
|
172
boot.php
172
boot.php
|
@ -28,9 +28,9 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -43,13 +43,6 @@ define('FRIENDICA_VERSION', '2018.12-dev');
|
|||
define('DFRN_PROTOCOL_VERSION', '2.23');
|
||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||
|
||||
/**
|
||||
* @brief Constants for the database update check
|
||||
*/
|
||||
const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
|
||||
const DB_UPDATE_SUCCESSFUL = 1; // Database check was successful
|
||||
const DB_UPDATE_FAILED = 2; // Database check failed
|
||||
|
||||
/**
|
||||
* @brief Constant with a HTML line break.
|
||||
*
|
||||
|
@ -106,20 +99,6 @@ define('SSL_POLICY_FULL', 1);
|
|||
define('SSL_POLICY_SELFSIGN', 2);
|
||||
/* @}*/
|
||||
|
||||
/**
|
||||
* @name Logger
|
||||
*
|
||||
* log levels
|
||||
* @{
|
||||
*/
|
||||
define('LOGGER_WARNING', 0);
|
||||
define('LOGGER_INFO', 1);
|
||||
define('LOGGER_TRACE', 2);
|
||||
define('LOGGER_DEBUG', 3);
|
||||
define('LOGGER_DATA', 4);
|
||||
define('LOGGER_ALL', 5);
|
||||
/* @}*/
|
||||
|
||||
/**
|
||||
* @name Register
|
||||
*
|
||||
|
@ -133,18 +112,6 @@ define('REGISTER_OPEN', 2);
|
|||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Update
|
||||
*
|
||||
* DB update return values
|
||||
* @{
|
||||
*/
|
||||
define('UPDATE_SUCCESS', 0);
|
||||
define('UPDATE_FAILED', 1);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name CP
|
||||
*
|
||||
|
@ -446,143 +413,6 @@ function defaults() {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if request was an AJAX (xmlhttprequest) request.
|
||||
*
|
||||
* @param boolean $via_worker boolean Is the check run via the worker?
|
||||
*/
|
||||
function check_db($via_worker)
|
||||
{
|
||||
$build = Config::get('system', 'build');
|
||||
|
||||
if (empty($build)) {
|
||||
Config::set('system', 'build', DB_UPDATE_VERSION - 1);
|
||||
$build = DB_UPDATE_VERSION - 1;
|
||||
}
|
||||
|
||||
// We don't support upgrading from very old versions anymore
|
||||
if ($build < NEW_UPDATE_ROUTINE_VERSION) {
|
||||
die('You try to update from a version prior to database version 1170. The direct upgrade path is not supported. Please update to version 3.5.4 before updating to this version.');
|
||||
}
|
||||
|
||||
if ($build < DB_UPDATE_VERSION) {
|
||||
// When we cannot execute the database update via the worker, we will do it directly
|
||||
if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) {
|
||||
update_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Automatic database updates
|
||||
* @param object $a App
|
||||
*/
|
||||
function update_db()
|
||||
{
|
||||
$build = Config::get('system', 'build');
|
||||
|
||||
if (empty($build) || ($build > DB_UPDATE_VERSION)) {
|
||||
$build = DB_UPDATE_VERSION - 1;
|
||||
Config::set('system', 'build', $build);
|
||||
}
|
||||
|
||||
if ($build != DB_UPDATE_VERSION) {
|
||||
require_once 'update.php';
|
||||
|
||||
$stored = intval($build);
|
||||
$current = intval(DB_UPDATE_VERSION);
|
||||
if ($stored < $current) {
|
||||
Config::load('database');
|
||||
|
||||
// Compare the current structure with the defined structure
|
||||
$t = Config::get('database', 'dbupdate_' . DB_UPDATE_VERSION);
|
||||
if (!is_null($t)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// run the pre_update_nnnn functions in update.php
|
||||
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||
$r = run_update_function($x, 'pre_update');
|
||||
if (!$r) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
|
||||
|
||||
// update the structure in one call
|
||||
$retval = DBStructure::update(false, true);
|
||||
if ($retval) {
|
||||
DBStructure::updateFail(
|
||||
DB_UPDATE_VERSION,
|
||||
$retval
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
|
||||
}
|
||||
|
||||
// run the update_nnnn functions in update.php
|
||||
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||
$r = run_update_function($x, 'update');
|
||||
if (!$r) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function run_update_function($x, $prefix)
|
||||
{
|
||||
$funcname = $prefix . '_' . $x;
|
||||
|
||||
if (function_exists($funcname)) {
|
||||
// There could be a lot of processes running or about to run.
|
||||
// We want exactly one process to run the update command.
|
||||
// So store the fact that we're taking responsibility
|
||||
// after first checking to see if somebody else already has.
|
||||
// If the update fails or times-out completely you may need to
|
||||
// delete the config entry to try again.
|
||||
|
||||
$t = Config::get('database', $funcname);
|
||||
if (!is_null($t)) {
|
||||
return false;
|
||||
}
|
||||
Config::set('database', $funcname, time());
|
||||
|
||||
// call the specific update
|
||||
$retval = $funcname();
|
||||
|
||||
if ($retval) {
|
||||
//send the administrator an e-mail
|
||||
DBStructure::updateFail(
|
||||
$x,
|
||||
L10n::t('Update %s failed. See error logs.', $x)
|
||||
);
|
||||
return false;
|
||||
} else {
|
||||
Config::set('database', $funcname, 'success');
|
||||
|
||||
if ($prefix == 'update') {
|
||||
Config::set('system', 'build', $x);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Config::set('database', $funcname, 'success');
|
||||
|
||||
if ($prefix == 'update') {
|
||||
Config::set('system', 'build', $x);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Used to end the current process, after saving session state.
|
||||
* @deprecated
|
||||
|
|
|
@ -160,11 +160,11 @@ In your code, like in the function addon_name_content(), load the template file
|
|||
```php
|
||||
# load template file. first argument is the template name,
|
||||
# second is the addon path relative to friendica top folder
|
||||
$tpl = get_markup_template('mytemplate.tpl', 'addon/addon_name/');
|
||||
$tpl = Renderer::getMarkupTemplate('mytemplate.tpl', 'addon/addon_name/');
|
||||
|
||||
# apply template. first argument is the loaded template,
|
||||
# second an array of 'name' => 'values' to pass to template
|
||||
$output = replace_macros($tpl, array(
|
||||
$output = Renderer::replaceMacros($tpl, array(
|
||||
'title' => 'My beautiful addon',
|
||||
));
|
||||
```
|
||||
|
|
|
@ -20,10 +20,10 @@ Templates that are only used by addons shall be placed in the
|
|||
|
||||
directory.
|
||||
|
||||
To render a template use the function *get_markup_template* to load the template and *replace_macros* to replace the macros/variables in the just loaded template file.
|
||||
To render a template use the function *getMarkupTemplate* to load the template and *replaceMacros* to replace the macros/variables in the just loaded template file.
|
||||
|
||||
$tpl = get_markup_template('install_settings.tpl');
|
||||
$o .= replace_macros($tpl, array( ... ));
|
||||
$tpl = Renderer::getMarkupTemplate('install_settings.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, array( ... ));
|
||||
|
||||
the array consists of an association of an identifier and the value for that identifier, i.e.
|
||||
|
||||
|
|
103
include/api.php
103
include/api.php
|
@ -15,6 +15,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Authentication;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
|
@ -96,9 +97,9 @@ function api_source()
|
|||
return "Twidere";
|
||||
}
|
||||
|
||||
logger("Unrecognized user-agent ".$_SERVER['HTTP_USER_AGENT'], LOGGER_DEBUG);
|
||||
Logger::log("Unrecognized user-agent ".$_SERVER['HTTP_USER_AGENT'], Logger::DEBUG);
|
||||
} else {
|
||||
logger("Empty user-agent", LOGGER_DEBUG);
|
||||
Logger::log("Empty user-agent", Logger::DEBUG);
|
||||
}
|
||||
|
||||
return "api";
|
||||
|
@ -180,7 +181,7 @@ function api_login(App $a)
|
|||
var_dump($consumer, $token);
|
||||
die();
|
||||
} catch (Exception $e) {
|
||||
logger($e);
|
||||
Logger::log($e);
|
||||
}
|
||||
|
||||
// workaround for HTTP-auth in CGI mode
|
||||
|
@ -194,7 +195,7 @@ function api_login(App $a)
|
|||
}
|
||||
|
||||
if (!x($_SERVER, 'PHP_AUTH_USER')) {
|
||||
logger('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
|
||||
Logger::log('API_login: ' . print_r($_SERVER, true), Logger::DEBUG);
|
||||
header('WWW-Authenticate: Basic realm="Friendica"');
|
||||
throw new UnauthorizedException("This API requires login");
|
||||
}
|
||||
|
@ -235,7 +236,7 @@ function api_login(App $a)
|
|||
}
|
||||
|
||||
if (!DBA::isResult($record)) {
|
||||
logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
|
||||
Logger::log('API_login failure: ' . print_r($_SERVER, true), Logger::DEBUG);
|
||||
header('WWW-Authenticate: Basic realm="Friendica"');
|
||||
//header('HTTP/1.0 401 Unauthorized');
|
||||
//die('This api requires login');
|
||||
|
@ -308,19 +309,19 @@ function api_call(App $a)
|
|||
api_login($a);
|
||||
}
|
||||
|
||||
logger('API call for ' . $a->user['username'] . ': ' . $a->query_string);
|
||||
logger('API parameters: ' . print_r($_REQUEST, true));
|
||||
Logger::log('API call for ' . $a->user['username'] . ': ' . $a->query_string);
|
||||
Logger::log('API parameters: ' . print_r($_REQUEST, true));
|
||||
|
||||
$stamp = microtime(true);
|
||||
$return = call_user_func($info['func'], $type);
|
||||
$duration = (float) (microtime(true) - $stamp);
|
||||
logger("API call duration: " . round($duration, 2) . "\t" . $a->query_string, LOGGER_DEBUG);
|
||||
Logger::log("API call duration: " . round($duration, 2) . "\t" . $a->query_string, Logger::DEBUG);
|
||||
|
||||
if (Config::get("system", "profiler")) {
|
||||
$duration = microtime(true)-$a->performance["start"];
|
||||
|
||||
/// @TODO round() really everywhere?
|
||||
logger(
|
||||
Logger::log(
|
||||
parse_url($a->query_string, PHP_URL_PATH) . ": " . sprintf(
|
||||
"Database: %s/%s, Cache %s/%s, Network: %s, I/O: %s, Other: %s, Total: %s",
|
||||
round($a->performance["database"] - $a->performance["database_write"], 3),
|
||||
|
@ -334,7 +335,7 @@ function api_call(App $a)
|
|||
+ $a->performance["network"] + $a->performance["file"]), 2),
|
||||
round($duration, 2)
|
||||
),
|
||||
LOGGER_DEBUG
|
||||
Logger::DEBUG
|
||||
);
|
||||
|
||||
if (Config::get("rendertime", "callstack")) {
|
||||
|
@ -375,7 +376,7 @@ function api_call(App $a)
|
|||
$o .= $func . ": " . $time . "\n";
|
||||
}
|
||||
}
|
||||
logger($o, LOGGER_DEBUG);
|
||||
Logger::log($o, Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,7 +413,7 @@ function api_call(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
logger('API call not implemented: ' . $a->query_string);
|
||||
Logger::log('API call not implemented: ' . $a->query_string);
|
||||
throw new NotImplementedException();
|
||||
} catch (HTTPException $e) {
|
||||
header("HTTP/1.1 {$e->httpcode} {$e->httpdesc}");
|
||||
|
@ -521,7 +522,7 @@ function api_get_user(App $a, $contact_id = null)
|
|||
$extra_query = "";
|
||||
$url = "";
|
||||
|
||||
logger("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
|
||||
Logger::log("api_get_user: Fetching user data for user ".$contact_id, Logger::DEBUG);
|
||||
|
||||
// Searching for contact URL
|
||||
if (!is_null($contact_id) && (intval($contact_id) == 0)) {
|
||||
|
@ -605,7 +606,7 @@ function api_get_user(App $a, $contact_id = null)
|
|||
}
|
||||
}
|
||||
|
||||
logger("api_get_user: user ".$user, LOGGER_DEBUG);
|
||||
Logger::log("api_get_user: user ".$user, Logger::DEBUG);
|
||||
|
||||
if (!$user) {
|
||||
if (api_user() === false) {
|
||||
|
@ -617,7 +618,7 @@ function api_get_user(App $a, $contact_id = null)
|
|||
}
|
||||
}
|
||||
|
||||
logger('api_user: ' . $extra_query . ', user: ' . $user);
|
||||
Logger::log('api_user: ' . $extra_query . ', user: ' . $user);
|
||||
|
||||
// user info
|
||||
$uinfo = q(
|
||||
|
@ -1033,7 +1034,7 @@ function api_statuses_mediap($type)
|
|||
$a = get_app();
|
||||
|
||||
if (api_user() === false) {
|
||||
logger('api_statuses_update: no user');
|
||||
Logger::log('api_statuses_update: no user');
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
$user_info = api_get_user($a);
|
||||
|
@ -1081,7 +1082,7 @@ function api_statuses_update($type)
|
|||
$a = get_app();
|
||||
|
||||
if (api_user() === false) {
|
||||
logger('api_statuses_update: no user');
|
||||
Logger::log('api_statuses_update: no user');
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
|
@ -1135,7 +1136,7 @@ function api_statuses_update($type)
|
|||
$posts_day = DBA::count('thread', $condition);
|
||||
|
||||
if ($posts_day > $throttle_day) {
|
||||
logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||
Logger::log('Daily posting limit reached for user '.api_user(), Logger::DEBUG);
|
||||
// die(api_error($type, L10n::t("Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
|
||||
throw new TooManyRequestsException(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));
|
||||
}
|
||||
|
@ -1149,7 +1150,7 @@ function api_statuses_update($type)
|
|||
$posts_week = DBA::count('thread', $condition);
|
||||
|
||||
if ($posts_week > $throttle_week) {
|
||||
logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||
Logger::log('Weekly posting limit reached for user '.api_user(), Logger::DEBUG);
|
||||
// die(api_error($type, L10n::t("Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week)));
|
||||
throw new TooManyRequestsException(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));
|
||||
}
|
||||
|
@ -1163,7 +1164,7 @@ function api_statuses_update($type)
|
|||
$posts_month = DBA::count('thread', $condition);
|
||||
|
||||
if ($posts_month > $throttle_month) {
|
||||
logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||
Logger::log('Monthly posting limit reached for user '.api_user(), Logger::DEBUG);
|
||||
// die(api_error($type, L10n::t("Monthly posting limit of %d posts reached. The post was rejected.", $throttle_month));
|
||||
throw new TooManyRequestsException(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));
|
||||
}
|
||||
|
@ -1223,7 +1224,7 @@ function api_media_upload()
|
|||
$a = get_app();
|
||||
|
||||
if (api_user() === false) {
|
||||
logger('no user');
|
||||
Logger::log('no user');
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
|
@ -1248,7 +1249,7 @@ function api_media_upload()
|
|||
"h" => $media["height"],
|
||||
"image_type" => $media["type"]];
|
||||
|
||||
logger("Media uploaded: " . print_r($returndata, true), LOGGER_DEBUG);
|
||||
Logger::log("Media uploaded: " . print_r($returndata, true), Logger::DEBUG);
|
||||
|
||||
return ["media" => $returndata];
|
||||
}
|
||||
|
@ -1268,7 +1269,7 @@ function api_status_show($type, $item_id = 0)
|
|||
|
||||
$user_info = api_get_user($a);
|
||||
|
||||
logger('api_status_show: user_info: '.print_r($user_info, true), LOGGER_DEBUG);
|
||||
Logger::log('api_status_show: user_info: '.print_r($user_info, true), Logger::DEBUG);
|
||||
|
||||
if ($type == "raw") {
|
||||
$privacy_sql = "AND NOT `private`";
|
||||
|
@ -1344,7 +1345,7 @@ function api_status_show($type, $item_id = 0)
|
|||
unset($status_info["user"]["uid"]);
|
||||
unset($status_info["user"]["self"]);
|
||||
|
||||
logger('status_info: '.print_r($status_info, true), LOGGER_DEBUG);
|
||||
Logger::log('status_info: '.print_r($status_info, true), Logger::DEBUG);
|
||||
|
||||
if ($type == "raw") {
|
||||
return $status_info;
|
||||
|
@ -1824,7 +1825,7 @@ function api_statuses_show($type)
|
|||
$id = intval(defaults($a->argv, 4, 0));
|
||||
}
|
||||
|
||||
logger('API: api_statuses_show: ' . $id);
|
||||
Logger::log('API: api_statuses_show: ' . $id);
|
||||
|
||||
$conversation = !empty($_REQUEST['conversation']);
|
||||
|
||||
|
@ -1906,7 +1907,7 @@ function api_conversation_show($type)
|
|||
$id = intval(defaults($a->argv, 4, 0));
|
||||
}
|
||||
|
||||
logger('API: api_conversation_show: '.$id);
|
||||
Logger::log('API: api_conversation_show: '.$id);
|
||||
|
||||
// try to fetch the item for the local user - or the public item, if there is no local one
|
||||
$item = Item::selectFirst(['parent-uri'], ['id' => $id]);
|
||||
|
@ -1977,7 +1978,7 @@ function api_statuses_repeat($type)
|
|||
$id = intval(defaults($a->argv, 4, 0));
|
||||
}
|
||||
|
||||
logger('API: api_statuses_repeat: '.$id);
|
||||
Logger::log('API: api_statuses_repeat: '.$id);
|
||||
|
||||
$fields = ['body', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
|
||||
$item = Item::selectFirst($fields, ['id' => $id, 'private' => false]);
|
||||
|
@ -2042,7 +2043,7 @@ function api_statuses_destroy($type)
|
|||
$id = intval(defaults($a->argv, 4, 0));
|
||||
}
|
||||
|
||||
logger('API: api_statuses_destroy: '.$id);
|
||||
Logger::log('API: api_statuses_destroy: '.$id);
|
||||
|
||||
$ret = api_statuses_show($type);
|
||||
|
||||
|
@ -2137,11 +2138,11 @@ function api_statuses_user_timeline($type)
|
|||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
logger(
|
||||
Logger::log(
|
||||
"api_statuses_user_timeline: api_user: ". api_user() .
|
||||
"\nuser_info: ".print_r($user_info, true) .
|
||||
"\n_REQUEST: ".print_r($_REQUEST, true),
|
||||
LOGGER_DEBUG
|
||||
Logger::DEBUG
|
||||
);
|
||||
|
||||
$since_id = x($_REQUEST, 'since_id') ? $_REQUEST['since_id'] : 0;
|
||||
|
@ -2294,7 +2295,7 @@ function api_favorites($type)
|
|||
|
||||
// in friendica starred item are private
|
||||
// return favorites only for self
|
||||
logger('api_favorites: self:' . $user_info['self']);
|
||||
Logger::log('api_favorites: self:' . $user_info['self']);
|
||||
|
||||
if ($user_info['self'] == 0) {
|
||||
$ret = [];
|
||||
|
@ -3649,7 +3650,7 @@ function api_friendships_destroy($type)
|
|||
$contact_id = defaults($_REQUEST, 'user_id');
|
||||
|
||||
if (empty($contact_id)) {
|
||||
logger("No user_id specified", LOGGER_DEBUG);
|
||||
Logger::log("No user_id specified", Logger::DEBUG);
|
||||
throw new BadRequestException("no user_id specified");
|
||||
}
|
||||
|
||||
|
@ -3657,7 +3658,7 @@ function api_friendships_destroy($type)
|
|||
$contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => 0, 'self' => false]);
|
||||
|
||||
if(!DBA::isResult($contact)) {
|
||||
logger("No contact found for ID" . $contact_id, LOGGER_DEBUG);
|
||||
Logger::log("No contact found for ID" . $contact_id, Logger::DEBUG);
|
||||
throw new NotFoundException("no contact found to given ID");
|
||||
}
|
||||
|
||||
|
@ -3669,12 +3670,12 @@ function api_friendships_destroy($type)
|
|||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
logger("Not following Contact", LOGGER_DEBUG);
|
||||
Logger::log("Not following Contact", Logger::DEBUG);
|
||||
throw new NotFoundException("Not following Contact");
|
||||
}
|
||||
|
||||
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||
logger("Not supported", LOGGER_DEBUG);
|
||||
Logger::log("Not supported", Logger::DEBUG);
|
||||
throw new ExpectationFailedException("Not supported");
|
||||
}
|
||||
|
||||
|
@ -3685,7 +3686,7 @@ function api_friendships_destroy($type)
|
|||
Contact::terminateFriendship($owner, $contact, $dissolve);
|
||||
}
|
||||
else {
|
||||
logger("No owner found", LOGGER_DEBUG);
|
||||
Logger::log("No owner found", Logger::DEBUG);
|
||||
throw new NotFoundException("Error Processing Request");
|
||||
}
|
||||
|
||||
|
@ -4485,10 +4486,10 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
if ($imagedata) {
|
||||
$filetype = $imagedata['mime'];
|
||||
}
|
||||
logger(
|
||||
Logger::log(
|
||||
"File upload src: " . $src . " - filename: " . $filename .
|
||||
" - size: " . $filesize . " - type: " . $filetype,
|
||||
LOGGER_DEBUG
|
||||
Logger::DEBUG
|
||||
);
|
||||
|
||||
// check if there was a php upload error
|
||||
|
@ -4520,7 +4521,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
}
|
||||
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();
|
||||
$height = $Image->getHeight();
|
||||
|
@ -4530,17 +4531,17 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
|
||||
if ($mediatype == "photo") {
|
||||
// upload normal image (scales 0, 1, 2)
|
||||
logger("photo upload: starting new photo upload", LOGGER_DEBUG);
|
||||
Logger::log("photo upload: starting new photo upload", Logger::DEBUG);
|
||||
|
||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||
if (!$r) {
|
||||
logger("photo upload: image upload with scale 0 (original size) failed");
|
||||
Logger::log("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, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||
if (!$r) {
|
||||
logger("photo upload: image upload with scale 1 (640x640) failed");
|
||||
Logger::log("photo upload: image upload with scale 1 (640x640) failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4548,19 +4549,19 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
$Image->scaleDown(320);
|
||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||
if (!$r) {
|
||||
logger("photo upload: image upload with scale 2 (320x320) failed");
|
||||
Logger::log("photo upload: image upload with scale 2 (320x320) failed");
|
||||
}
|
||||
}
|
||||
logger("photo upload: new photo upload ended", LOGGER_DEBUG);
|
||||
Logger::log("photo upload: new photo upload ended", Logger::DEBUG);
|
||||
} elseif ($mediatype == "profileimage") {
|
||||
// upload profile image (scales 4, 5, 6)
|
||||
logger("photo upload: starting new profile image upload", LOGGER_DEBUG);
|
||||
Logger::log("photo upload: starting new profile image upload", Logger::DEBUG);
|
||||
|
||||
if ($width > 300 || $height > 300) {
|
||||
$Image->scaleDown(300);
|
||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||
if (!$r) {
|
||||
logger("photo upload: profile image upload with scale 4 (300x300) failed");
|
||||
Logger::log("photo upload: profile image upload with scale 4 (300x300) failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4568,7 +4569,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
$Image->scaleDown(80);
|
||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||
if (!$r) {
|
||||
logger("photo upload: profile image upload with scale 5 (80x80) failed");
|
||||
Logger::log("photo upload: profile image upload with scale 5 (80x80) failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4576,11 +4577,11 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
$Image->scaleDown(48);
|
||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||
if (!$r) {
|
||||
logger("photo upload: profile image upload with scale 6 (48x48) failed");
|
||||
Logger::log("photo upload: profile image upload with scale 6 (48x48) failed");
|
||||
}
|
||||
}
|
||||
$Image->__destruct();
|
||||
logger("photo upload: new profile image upload ended", LOGGER_DEBUG);
|
||||
Logger::log("photo upload: new profile image upload ended", Logger::DEBUG);
|
||||
}
|
||||
|
||||
if (isset($r) && $r) {
|
||||
|
@ -4807,7 +4808,7 @@ function api_friendica_remoteauth()
|
|||
'sec' => $sec, 'expire' => time() + 45];
|
||||
DBA::insert('profile_check', $fields);
|
||||
|
||||
logger($contact['name'] . ' ' . $sec, LOGGER_DEBUG);
|
||||
Logger::log($contact['name'] . ' ' . $sec, Logger::DEBUG);
|
||||
$dest = ($url ? '&destination_url=' . $url : '');
|
||||
|
||||
System::externalRedirect(
|
||||
|
@ -5055,7 +5056,7 @@ function api_in_reply_to($item)
|
|||
// https://github.com/friendica/friendica/issues/1010
|
||||
// This is a bugfix for that.
|
||||
if (intval($in_reply_to['status_id']) == intval($item['id'])) {
|
||||
logger('this message should never appear: id: '.$item['id'].' similar to reply-to: '.$in_reply_to['status_id'], LOGGER_DEBUG);
|
||||
Logger::log('this message should never appear: id: '.$item['id'].' similar to reply-to: '.$in_reply_to['status_id'], Logger::DEBUG);
|
||||
$in_reply_to['status_id'] = null;
|
||||
$in_reply_to['user_id'] = null;
|
||||
$in_reply_to['status_id_str'] = null;
|
||||
|
|
|
@ -11,8 +11,10 @@ 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\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -552,7 +554,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
|
|||
$threads = [];
|
||||
$threadsid = -1;
|
||||
|
||||
$page_template = get_markup_template("conversation.tpl");
|
||||
$page_template = Renderer::getMarkupTemplate("conversation.tpl");
|
||||
|
||||
if (!empty($items)) {
|
||||
if (in_array($mode, ['community', 'contacts'])) {
|
||||
|
@ -711,7 +713,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
|
|||
}
|
||||
} else {
|
||||
// Normal View
|
||||
$page_template = get_markup_template("threaded_conversation.tpl");
|
||||
$page_template = Renderer::getMarkupTemplate("threaded_conversation.tpl");
|
||||
|
||||
$conv = new Thread($mode, $preview, $writable);
|
||||
|
||||
|
@ -751,13 +753,13 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
|
|||
|
||||
$threads = $conv->getTemplateData($conv_responses);
|
||||
if (!$threads) {
|
||||
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
|
||||
Logger::log('[ERROR] conversation : Failed to get template data.', Logger::DEBUG);
|
||||
$threads = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$o = replace_macros($page_template, [
|
||||
$o = Renderer::replaceMacros($page_template, [
|
||||
'$baseurl' => System::baseUrl($ssl_state),
|
||||
'$return_path' => $a->query_string,
|
||||
'$live_update' => $live_update_div,
|
||||
|
@ -1061,7 +1063,7 @@ function format_like($cnt, array $arr, $type, $id) {
|
|||
}
|
||||
|
||||
$phrase .= EOL ;
|
||||
$o .= replace_macros(get_markup_template('voting_fakelink.tpl'), [
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [
|
||||
'$phrase' => $phrase,
|
||||
'$type' => $type,
|
||||
'$id' => $id
|
||||
|
@ -1075,10 +1077,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
|
|||
{
|
||||
$o = '';
|
||||
|
||||
$geotag = x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), []) : '';
|
||||
$geotag = x($x, 'allow_location') ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
|
||||
|
||||
$tpl = get_markup_template('jot-header.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$newpost' => 'true',
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
'$geotag' => $geotag,
|
||||
|
@ -1116,10 +1118,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
|
|||
$public_post_link = '&public=1';
|
||||
}
|
||||
|
||||
// $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
|
||||
$tpl = get_markup_template("jot.tpl");
|
||||
// $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins));
|
||||
$tpl = Renderer::getMarkupTemplate("jot.tpl");
|
||||
|
||||
$o .= replace_macros($tpl,[
|
||||
$o .= Renderer::replaceMacros($tpl,[
|
||||
'$new_post' => L10n::t('New Post'),
|
||||
'$return_path' => $query_str,
|
||||
'$action' => 'item',
|
||||
|
|
|
@ -7,6 +7,8 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -29,7 +31,7 @@ function notification($params)
|
|||
|
||||
// Temporary logging for finding the origin
|
||||
if (!isset($params['language']) || !isset($params['uid'])) {
|
||||
logger('Missing parameters.' . System::callstack());
|
||||
Logger::log('Missing parameters.' . System::callstack());
|
||||
}
|
||||
|
||||
// Ensure that the important fields are set at any time
|
||||
|
@ -37,7 +39,7 @@ function notification($params)
|
|||
$user = DBA::selectFirst('user', $fields, ['uid' => $params['uid']]);
|
||||
|
||||
if (!DBA::isResult($user)) {
|
||||
logger('Unknown user ' . $params['uid']);
|
||||
Logger::log('Unknown user ' . $params['uid']);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -133,7 +135,7 @@ function notification($params)
|
|||
if ($params['type'] == NOTIFY_COMMENT) {
|
||||
$thread = Item::selectFirstThreadForUser($params['uid'] ,['ignored'], ['iid' => $parent_id]);
|
||||
if (DBA::isResult($thread) && $thread["ignored"]) {
|
||||
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
|
||||
Logger::log("Thread ".$parent_id." will be ignored", Logger::DEBUG);
|
||||
L10n::popLang();
|
||||
return;
|
||||
}
|
||||
|
@ -452,7 +454,7 @@ function notification($params)
|
|||
$itemlink = $h['itemlink'];
|
||||
|
||||
if ($show_in_notification_page) {
|
||||
logger("adding notification entry", LOGGER_DEBUG);
|
||||
Logger::log("adding notification entry", Logger::DEBUG);
|
||||
do {
|
||||
$dups = false;
|
||||
$hash = random_string();
|
||||
|
@ -516,7 +518,7 @@ function notification($params)
|
|||
}
|
||||
|
||||
$itemlink = System::baseUrl().'/notify/view/'.$notify_id;
|
||||
$msg = replace_macros($epreamble, ['$itemlink' => $itemlink]);
|
||||
$msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $itemlink]);
|
||||
$msg_cache = format_notification_message($datarray['name_cache'], strip_tags(BBCode::convert($msg)));
|
||||
|
||||
$fields = ['msg' => $msg, 'msg_cache' => $msg_cache];
|
||||
|
@ -529,14 +531,14 @@ function notification($params)
|
|||
|| $params['type'] == NOTIFY_SYSTEM
|
||||
|| $params['type'] == SYSTEM_EMAIL) {
|
||||
|
||||
logger('sending notification email');
|
||||
Logger::log('sending notification email');
|
||||
|
||||
if (isset($params['parent']) && (intval($params['parent']) != 0)) {
|
||||
$id_for_parent = $params['parent']."@".$hostname;
|
||||
|
||||
// Is this the first email notification for this parent item and user?
|
||||
if (!DBA::exists('notify-threads', ['master-parent-item' => $params['parent'], 'receiver-uid' => $params['uid']])) {
|
||||
logger("notify_id:".intval($notify_id).", parent: ".intval($params['parent'])."uid: ".intval($params['uid']), LOGGER_DEBUG);
|
||||
Logger::log("notify_id:".intval($notify_id).", parent: ".intval($params['parent'])."uid: ".intval($params['uid']), Logger::DEBUG);
|
||||
|
||||
$fields = ['notify-id' => $notify_id, 'master-parent-item' => $params['parent'],
|
||||
'receiver-uid' => $params['uid'], 'parent-item' => 0];
|
||||
|
@ -545,11 +547,11 @@ function notification($params)
|
|||
$additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
|
||||
$log_msg = "include/enotify: No previous notification found for this parent:\n".
|
||||
" parent: ${params['parent']}\n"." uid : ${params['uid']}\n";
|
||||
logger($log_msg, LOGGER_DEBUG);
|
||||
Logger::log($log_msg, Logger::DEBUG);
|
||||
} else {
|
||||
// If not, just "follow" the thread.
|
||||
$additional_mail_header .= "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n";
|
||||
logger("There's already a notification for this parent.", LOGGER_DEBUG);
|
||||
Logger::log("There's already a notification for this parent.", Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,8 +590,8 @@ function notification($params)
|
|||
$content_allowed = ((!Config::get('system', 'enotify_no_content')) || ($params['type'] == SYSTEM_EMAIL));
|
||||
|
||||
// load the template for private message notifications
|
||||
$tpl = get_markup_template('email_notify_html.tpl');
|
||||
$email_html_body = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('email_notify_html.tpl');
|
||||
$email_html_body = Renderer::replaceMacros($tpl, [
|
||||
'$banner' => $datarray['banner'],
|
||||
'$product' => $datarray['product'],
|
||||
'$preamble' => str_replace("\n", "<br>\n", $datarray['preamble']),
|
||||
|
@ -609,8 +611,8 @@ function notification($params)
|
|||
]);
|
||||
|
||||
// load the template for private message notifications
|
||||
$tpl = get_markup_template('email_notify_text.tpl');
|
||||
$email_text_body = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('email_notify_text.tpl');
|
||||
$email_text_body = Renderer::replaceMacros($tpl, [
|
||||
'$banner' => $datarray['banner'],
|
||||
'$product' => $datarray['product'],
|
||||
'$preamble' => $datarray['preamble'],
|
||||
|
|
|
@ -8,8 +8,10 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -109,7 +111,7 @@ function query_page_info($url, $photo = "", $keywords = false, $keyword_blacklis
|
|||
$data["images"][0]["src"] = $photo;
|
||||
}
|
||||
|
||||
logger('fetch page info for ' . $url . ' ' . print_r($data, true), LOGGER_DEBUG);
|
||||
Logger::log('fetch page info for ' . $url . ' ' . print_r($data, true), Logger::DEBUG);
|
||||
|
||||
if (!$keywords && isset($data["keywords"])) {
|
||||
unset($data["keywords"]);
|
||||
|
@ -167,7 +169,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false,
|
|||
|
||||
function add_page_info_to_body($body, $texturl = false, $no_photos = false)
|
||||
{
|
||||
logger('add_page_info_to_body: fetch page info for body ' . $body, LOGGER_DEBUG);
|
||||
Logger::log('add_page_info_to_body: fetch page info for body ' . $body, Logger::DEBUG);
|
||||
|
||||
$URLSearchString = "^\[\]";
|
||||
|
||||
|
@ -251,7 +253,7 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0
|
|||
// Test - remove before flight
|
||||
//$tempfile = tempnam(get_temppath(), "ostatus2");
|
||||
//file_put_contents($tempfile, $xml);
|
||||
logger("Consume OStatus messages ", LOGGER_DEBUG);
|
||||
Logger::log("Consume OStatus messages ", Logger::DEBUG);
|
||||
OStatus::import($xml, $importer, $contact, $hub);
|
||||
}
|
||||
|
||||
|
@ -260,7 +262,7 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0
|
|||
|
||||
if ($contact['network'] === Protocol::FEED) {
|
||||
if ($pass < 2) {
|
||||
logger("Consume feeds", LOGGER_DEBUG);
|
||||
Logger::log("Consume feeds", Logger::DEBUG);
|
||||
Feed::import($xml, $importer, $contact, $hub);
|
||||
}
|
||||
|
||||
|
@ -268,10 +270,10 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0
|
|||
}
|
||||
|
||||
if ($contact['network'] === Protocol::DFRN) {
|
||||
logger("Consume DFRN messages", LOGGER_DEBUG);
|
||||
Logger::log("Consume DFRN messages", Logger::DEBUG);
|
||||
$dfrn_importer = DFRN::getImporter($contact["id"], $importer["uid"]);
|
||||
if (!empty($dfrn_importer)) {
|
||||
logger("Now import the DFRN feed");
|
||||
Logger::log("Now import the DFRN feed");
|
||||
DFRN::import($xml, $dfrn_importer, true);
|
||||
return;
|
||||
}
|
||||
|
@ -310,7 +312,7 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub
|
|||
|
||||
$params= 'hub.mode=' . $hubmode . '&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token;
|
||||
|
||||
logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
|
||||
Logger::log('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
|
||||
|
||||
if (!strlen($contact['hub-verify']) || ($contact['hub-verify'] != $verify_token)) {
|
||||
DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
|
||||
|
@ -318,7 +320,7 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub
|
|||
|
||||
$postResult = Network::post($url, $params);
|
||||
|
||||
logger('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), LOGGER_DEBUG);
|
||||
Logger::log('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), Logger::DEBUG);
|
||||
|
||||
return;
|
||||
|
||||
|
@ -343,7 +345,7 @@ function drop_items(array $items)
|
|||
}
|
||||
}
|
||||
|
||||
function drop_item($id)
|
||||
function drop_item($id, $return = '')
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
|
||||
|
@ -389,7 +391,7 @@ function drop_item($id)
|
|||
}
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('confirm.tpl'), [
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
|
||||
'$method' => 'get',
|
||||
'$message' => L10n::t('Do you really want to delete this item?'),
|
||||
'$extra_inputs' => $inputs,
|
||||
|
@ -407,8 +409,15 @@ function drop_item($id)
|
|||
// delete the item
|
||||
Item::deleteForUser(['id' => $item['id']], local_user());
|
||||
|
||||
$a->internalRedirect('network');
|
||||
//NOTREACHED
|
||||
$return_url = hex2bin($return);
|
||||
if (empty($return_url) || strpos($return_url, 'display') !== false) {
|
||||
$a->internalRedirect('network');
|
||||
//NOTREACHED
|
||||
}
|
||||
else {
|
||||
$a->internalRedirect($return_url);
|
||||
//NOTREACHED
|
||||
}
|
||||
} else {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
$a->internalRedirect('display/' . $item['guid']);
|
||||
|
@ -480,7 +489,7 @@ function posted_date_widget($url, $uid, $wall)
|
|||
$cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years;
|
||||
$cutoff = ((array_key_exists($cutoff_year, $ret))? true : false);
|
||||
|
||||
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),[
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('posted_date_widget.tpl'),[
|
||||
'$title' => L10n::t('Archives'),
|
||||
'$size' => $visible_years,
|
||||
'$cutoff_year' => $cutoff_year,
|
||||
|
|
414
include/text.php
414
include/text.php
|
@ -23,38 +23,12 @@ use Friendica\Util\DateTimeFormat;
|
|||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Model\FileTag;
|
||||
|
||||
require_once "include/conversation.php";
|
||||
|
||||
/**
|
||||
* This is our template processor
|
||||
*
|
||||
* @param string|FriendicaSmarty $s the string requiring macro substitution,
|
||||
* or an instance of FriendicaSmarty
|
||||
* @param array $r key value pairs (search => replace)
|
||||
* @return string substituted string
|
||||
*/
|
||||
function replace_macros($s, $r) {
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$a = get_app();
|
||||
|
||||
// pass $baseurl to all templates
|
||||
$r['$baseurl'] = System::baseUrl();
|
||||
|
||||
$t = $a->getTemplateEngine();
|
||||
try {
|
||||
$output = $t->replaceMacros($s, $r);
|
||||
} catch (Exception $e) {
|
||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||
killme();
|
||||
}
|
||||
|
||||
$a->saveTimestamp($stamp1, "rendering");
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generates a pseudo-random string of hexadecimal characters
|
||||
*
|
||||
|
@ -267,8 +241,8 @@ function unxmlify($s) {
|
|||
* @return string html for loader
|
||||
*/
|
||||
function scroll_loader() {
|
||||
$tpl = get_markup_template("scroll_loader.tpl");
|
||||
return replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("scroll_loader.tpl");
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'wait' => L10n::t('Loading more entries...'),
|
||||
'end' => L10n::t('The end')
|
||||
]);
|
||||
|
@ -336,30 +310,6 @@ function perms2str($p) {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* load template $s
|
||||
*
|
||||
* @param string $s
|
||||
* @param string $root
|
||||
* @return string
|
||||
*/
|
||||
function get_markup_template($s, $root = '') {
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$a = get_app();
|
||||
$t = $a->getTemplateEngine();
|
||||
try {
|
||||
$template = $t->getTemplateFile($s, $root);
|
||||
} catch (Exception $e) {
|
||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||
killme();
|
||||
}
|
||||
|
||||
$a->saveTimestamp($stamp1, "file");
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* for html,xml parsing - let's say you've got
|
||||
* an attribute foobar="class1 class2 class3"
|
||||
|
@ -379,139 +329,6 @@ function attribute_contains($attr, $s) {
|
|||
return (count($a) && in_array($s,$a));
|
||||
}
|
||||
|
||||
|
||||
/* setup int->string log level map */
|
||||
$LOGGER_LEVELS = [];
|
||||
|
||||
/**
|
||||
* @brief Logs the given message at the given log level
|
||||
*
|
||||
* log levels:
|
||||
* LOGGER_WARNING
|
||||
* LOGGER_INFO (default)
|
||||
* LOGGER_TRACE
|
||||
* LOGGER_DEBUG
|
||||
* LOGGER_DATA
|
||||
* LOGGER_ALL
|
||||
*
|
||||
* @global array $LOGGER_LEVELS
|
||||
* @param string $msg
|
||||
* @param int $level
|
||||
*/
|
||||
function logger($msg, $level = LOGGER_INFO) {
|
||||
$a = get_app();
|
||||
global $LOGGER_LEVELS;
|
||||
|
||||
$debugging = Config::get('system', 'debugging');
|
||||
$logfile = Config::get('system', 'logfile');
|
||||
$loglevel = intval(Config::get('system', 'loglevel'));
|
||||
|
||||
if (
|
||||
!$debugging
|
||||
|| !$logfile
|
||||
|| $level > $loglevel
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($LOGGER_LEVELS) == 0) {
|
||||
foreach (get_defined_constants() as $k => $v) {
|
||||
if (substr($k, 0, 7) == "LOGGER_") {
|
||||
$LOGGER_LEVELS[$v] = substr($k, 7, 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$process_id = session_id();
|
||||
|
||||
if ($process_id == '') {
|
||||
$process_id = get_app()->process_id;
|
||||
}
|
||||
|
||||
$callers = debug_backtrace();
|
||||
|
||||
if (count($callers) > 1) {
|
||||
$function = $callers[1]['function'];
|
||||
} else {
|
||||
$function = '';
|
||||
}
|
||||
|
||||
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
|
||||
DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
||||
$process_id,
|
||||
$LOGGER_LEVELS[$level],
|
||||
basename($callers[0]['file']),
|
||||
$callers[0]['line'],
|
||||
$function,
|
||||
$msg
|
||||
);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
@file_put_contents($logfile, $logline, FILE_APPEND);
|
||||
$a->saveTimestamp($stamp1, "file");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief An alternative logger for development.
|
||||
* Works largely as logger() but allows developers
|
||||
* to isolate particular elements they are targetting
|
||||
* personally without background noise
|
||||
*
|
||||
* log levels:
|
||||
* LOGGER_WARNING
|
||||
* LOGGER_INFO (default)
|
||||
* LOGGER_TRACE
|
||||
* LOGGER_DEBUG
|
||||
* LOGGER_DATA
|
||||
* LOGGER_ALL
|
||||
*
|
||||
* @global array $LOGGER_LEVELS
|
||||
* @param string $msg
|
||||
* @param int $level
|
||||
*/
|
||||
function dlogger($msg, $level = LOGGER_INFO) {
|
||||
$a = get_app();
|
||||
|
||||
$logfile = Config::get('system', 'dlogfile');
|
||||
if (!$logfile) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dlogip = Config::get('system', 'dlogip');
|
||||
if (!is_null($dlogip) && $_SERVER['REMOTE_ADDR'] != $dlogip) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($LOGGER_LEVELS) == 0) {
|
||||
foreach (get_defined_constants() as $k => $v) {
|
||||
if (substr($k, 0, 7) == "LOGGER_") {
|
||||
$LOGGER_LEVELS[$v] = substr($k, 7, 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$process_id = session_id();
|
||||
|
||||
if ($process_id == '') {
|
||||
$process_id = $a->process_id;
|
||||
}
|
||||
|
||||
$callers = debug_backtrace();
|
||||
$logline = sprintf("%s@\t%s:\t%s:\t%s\t%s\t%s\n",
|
||||
DateTimeFormat::utcNow(),
|
||||
$process_id,
|
||||
basename($callers[0]['file']),
|
||||
$callers[0]['line'],
|
||||
$callers[1]['function'],
|
||||
$msg
|
||||
);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
@file_put_contents($logfile, $logline, FILE_APPEND);
|
||||
$a->saveTimestamp($stamp1, "file");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compare activity uri. Knows about activity namespace.
|
||||
*
|
||||
|
@ -671,8 +488,8 @@ function contact_block() {
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('contact_block.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('contact_block.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$contacts' => $contacts,
|
||||
'$nickname' => $a->profile['nickname'],
|
||||
'$viewcontacts' => L10n::t('View Contacts'),
|
||||
|
@ -729,7 +546,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
|
|||
$url = '';
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[
|
||||
'$click' => defaults($contact, 'click', ''),
|
||||
'$class' => $class,
|
||||
'$url' => $url,
|
||||
|
@ -784,7 +601,7 @@ function search($s, $id = 'search-box', $url = 'search', $save = false, $aside =
|
|||
}
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('searchbox.tpl'), $values);
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('searchbox.tpl'), $values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1062,14 +879,14 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
|
|||
if (strpos($mime, 'video') !== false) {
|
||||
if (!$vhead) {
|
||||
$vhead = true;
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), [
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('videos_head.tpl'), [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
]);
|
||||
}
|
||||
|
||||
$url_parts = explode('/', $the_url);
|
||||
$id = end($url_parts);
|
||||
$as .= replace_macros(get_markup_template('video_top.tpl'), [
|
||||
$as .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [
|
||||
'$video' => [
|
||||
'id' => $id,
|
||||
'title' => L10n::t('View Video'),
|
||||
|
@ -1164,8 +981,8 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
|
|||
function apply_content_filter($html, array $reasons)
|
||||
{
|
||||
if (count($reasons)) {
|
||||
$tpl = get_markup_template('wall/content_filter.tpl');
|
||||
$html = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('wall/content_filter.tpl');
|
||||
$html = Renderer::replaceMacros($tpl, [
|
||||
'$reasons' => $reasons,
|
||||
'$rnd' => random_string(8),
|
||||
'$openclose' => L10n::t('Click to open/close'),
|
||||
|
@ -1230,9 +1047,9 @@ function get_cats_and_terms($item)
|
|||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$categories[] = [
|
||||
'name' => xmlify(file_tag_decode($mtch[1])),
|
||||
'name' => xmlify(FileTag::decode($mtch[1])),
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid'])?'filerm/' . $item['id'] . '?f=&cat=' . xmlify(file_tag_decode($mtch[1])):""),
|
||||
'removeurl' => ((local_user() == $item['uid'])?'filerm/' . $item['id'] . '?f=&cat=' . xmlify(FileTag::decode($mtch[1])):""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
|
@ -1251,9 +1068,9 @@ function get_cats_and_terms($item)
|
|||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$folders[] = [
|
||||
'name' => xmlify(file_tag_decode($mtch[1])),
|
||||
'name' => xmlify(FileTag::decode($mtch[1])),
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])) : ""),
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . xmlify(FileTag::decode($mtch[1])) : ""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
|
@ -1353,7 +1170,7 @@ function base64url_encode($s, $strip_padding = false) {
|
|||
function base64url_decode($s) {
|
||||
|
||||
if (is_array($s)) {
|
||||
logger('base64url_decode: illegal input: ' . print_r(debug_backtrace(), true));
|
||||
Logger::log('base64url_decode: illegal input: ' . print_r(debug_backtrace(), true));
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
@ -1491,199 +1308,6 @@ function item_post_type($item) {
|
|||
return L10n::t('post');
|
||||
}
|
||||
|
||||
// post categories and "save to file" use the same item.file table for storage.
|
||||
// We will differentiate the different uses by wrapping categories in angle brackets
|
||||
// and save to file categories in square brackets.
|
||||
// To do this we need to escape these characters if they appear in our tag.
|
||||
|
||||
function file_tag_encode($s) {
|
||||
return str_replace(['<','>','[',']'],['%3c','%3e','%5b','%5d'],$s);
|
||||
}
|
||||
|
||||
function file_tag_decode($s) {
|
||||
return str_replace(['%3c', '%3e', '%5b', '%5d'], ['<', '>', '[', ']'], $s);
|
||||
}
|
||||
|
||||
function file_tag_file_query($table,$s,$type = 'file') {
|
||||
|
||||
if ($type == 'file') {
|
||||
$str = preg_quote('[' . str_replace('%', '%%', file_tag_encode($s)) . ']');
|
||||
} else {
|
||||
$str = preg_quote('<' . str_replace('%', '%%', file_tag_encode($s)) . '>');
|
||||
}
|
||||
return " AND " . (($table) ? DBA::escape($table) . '.' : '') . "file regexp '" . DBA::escape($str) . "' ";
|
||||
}
|
||||
|
||||
// ex. given music,video return <music><video> or [music][video]
|
||||
function file_tag_list_to_file($list, $type = 'file') {
|
||||
$tag_list = '';
|
||||
if (strlen($list)) {
|
||||
$list_array = explode(",",$list);
|
||||
if ($type == 'file') {
|
||||
$lbracket = '[';
|
||||
$rbracket = ']';
|
||||
} else {
|
||||
$lbracket = '<';
|
||||
$rbracket = '>';
|
||||
}
|
||||
|
||||
foreach ($list_array as $item) {
|
||||
if (strlen($item)) {
|
||||
$tag_list .= $lbracket . file_tag_encode(trim($item)) . $rbracket;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tag_list;
|
||||
}
|
||||
|
||||
// ex. given <music><video>[friends], return music,video or friends
|
||||
function file_tag_file_to_list($file, $type = 'file') {
|
||||
$matches = false;
|
||||
$list = '';
|
||||
if ($type == 'file') {
|
||||
$cnt = preg_match_all('/\[(.*?)\]/', $file, $matches, PREG_SET_ORDER);
|
||||
} else {
|
||||
$cnt = preg_match_all('/<(.*?)>/', $file, $matches, PREG_SET_ORDER);
|
||||
}
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
if (strlen($list)) {
|
||||
$list .= ',';
|
||||
}
|
||||
$list .= file_tag_decode($mtch[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function file_tag_update_pconfig($uid, $file_old, $file_new, $type = 'file') {
|
||||
// $file_old - categories previously associated with an item
|
||||
// $file_new - new list of categories for an item
|
||||
|
||||
if (!intval($uid)) {
|
||||
return false;
|
||||
} elseif ($file_old == $file_new) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$saved = PConfig::get($uid, 'system', 'filetags');
|
||||
if (strlen($saved)) {
|
||||
if ($type == 'file') {
|
||||
$lbracket = '[';
|
||||
$rbracket = ']';
|
||||
$termtype = TERM_FILE;
|
||||
} else {
|
||||
$lbracket = '<';
|
||||
$rbracket = '>';
|
||||
$termtype = TERM_CATEGORY;
|
||||
}
|
||||
|
||||
$filetags_updated = $saved;
|
||||
|
||||
// check for new tags to be added as filetags in pconfig
|
||||
$new_tags = [];
|
||||
$check_new_tags = explode(",",file_tag_file_to_list($file_new,$type));
|
||||
|
||||
foreach ($check_new_tags as $tag) {
|
||||
if (!stristr($saved,$lbracket . file_tag_encode($tag) . $rbracket)) {
|
||||
$new_tags[] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
$filetags_updated .= file_tag_list_to_file(implode(",",$new_tags),$type);
|
||||
|
||||
// check for deleted tags to be removed from filetags in pconfig
|
||||
$deleted_tags = [];
|
||||
$check_deleted_tags = explode(",",file_tag_file_to_list($file_old,$type));
|
||||
|
||||
foreach ($check_deleted_tags as $tag) {
|
||||
if (!stristr($file_new,$lbracket . file_tag_encode($tag) . $rbracket)) {
|
||||
$deleted_tags[] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($deleted_tags as $key => $tag) {
|
||||
$r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",
|
||||
DBA::escape($tag),
|
||||
intval(TERM_OBJ_POST),
|
||||
intval($termtype),
|
||||
intval($uid));
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
unset($deleted_tags[$key]);
|
||||
} else {
|
||||
$filetags_updated = str_replace($lbracket . file_tag_encode($tag) . $rbracket,'',$filetags_updated);
|
||||
}
|
||||
}
|
||||
|
||||
if ($saved != $filetags_updated) {
|
||||
PConfig::set($uid, 'system', 'filetags', $filetags_updated);
|
||||
}
|
||||
return true;
|
||||
} elseif (strlen($file_new)) {
|
||||
PConfig::set($uid, 'system', 'filetags', $file_new);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function file_tag_save_file($uid, $item_id, $file)
|
||||
{
|
||||
if (!intval($uid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]);
|
||||
if (DBA::isResult($item)) {
|
||||
if (!stristr($item['file'],'[' . file_tag_encode($file) . ']')) {
|
||||
$fields = ['file' => $item['file'] . '[' . file_tag_encode($file) . ']'];
|
||||
Item::update($fields, ['id' => $item_id]);
|
||||
}
|
||||
$saved = PConfig::get($uid, 'system', 'filetags');
|
||||
if (!strlen($saved) || !stristr($saved, '[' . file_tag_encode($file) . ']')) {
|
||||
PConfig::set($uid, 'system', 'filetags', $saved . '[' . file_tag_encode($file) . ']');
|
||||
}
|
||||
info(L10n::t('Item filed'));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function file_tag_unsave_file($uid, $item_id, $file, $cat = false)
|
||||
{
|
||||
if (!intval($uid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($cat == true) {
|
||||
$pattern = '<' . file_tag_encode($file) . '>' ;
|
||||
$termtype = TERM_CATEGORY;
|
||||
} else {
|
||||
$pattern = '[' . file_tag_encode($file) . ']' ;
|
||||
$termtype = TERM_FILE;
|
||||
}
|
||||
|
||||
$item = Item::selectFirst(['file'], ['id' => $item_id, 'uid' => $uid]);
|
||||
if (!DBA::isResult($item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = ['file' => str_replace($pattern,'',$item['file'])];
|
||||
Item::update($fields, ['id' => $item_id]);
|
||||
|
||||
$r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",
|
||||
DBA::escape($file),
|
||||
intval(TERM_OBJ_POST),
|
||||
intval($termtype),
|
||||
intval($uid)
|
||||
);
|
||||
if (!DBA::isResult($r)) {
|
||||
$saved = PConfig::get($uid, 'system', 'filetags');
|
||||
PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function normalise_openid($s) {
|
||||
return trim(str_replace(['http://', 'https://'], ['', ''], $s), '/');
|
||||
}
|
||||
|
|
|
@ -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) . "%%'";
|
||||
|
|
116
mod/admin.php
116
mod/admin.php
|
@ -13,8 +13,11 @@ use Friendica\Content\Text\Markdown;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
|
@ -89,7 +92,7 @@ function admin_post(App $a)
|
|||
|
||||
$theme = $a->argv[2];
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
$orig_theme = $a->theme;
|
||||
$orig_theme = Renderer::$theme;
|
||||
$orig_page = $a->page;
|
||||
$orig_session_theme = $_SESSION['theme'];
|
||||
require_once "view/theme/$theme/theme.php";
|
||||
|
@ -105,7 +108,7 @@ function admin_post(App $a)
|
|||
}
|
||||
|
||||
$_SESSION['theme'] = $orig_session_theme;
|
||||
$a->theme = $orig_theme;
|
||||
Renderer::$theme = $orig_theme;
|
||||
$a->page = $orig_page;
|
||||
}
|
||||
|
||||
|
@ -173,7 +176,7 @@ function admin_content(App $a)
|
|||
// apc_delete($toDelete);
|
||||
//}
|
||||
// Header stuff
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('admin/settings_head.tpl'), []);
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);
|
||||
|
||||
/*
|
||||
* Side bar links
|
||||
|
@ -224,8 +227,8 @@ function admin_content(App $a)
|
|||
$addons_admin[] = $addon;
|
||||
}
|
||||
|
||||
$t = get_markup_template('admin/aside.tpl');
|
||||
$a->page['aside'] .= replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/aside.tpl');
|
||||
$a->page['aside'] .= Renderer::replaceMacros($t, [
|
||||
'$admin' => $aside_tools,
|
||||
'$subpages' => $aside_sub,
|
||||
'$admtxt' => L10n::t('Admin'),
|
||||
|
@ -312,8 +315,8 @@ function admin_content(App $a)
|
|||
function admin_page_tos(App $a)
|
||||
{
|
||||
$tos = new Tos();
|
||||
$t = get_markup_template('admin/tos.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/tos.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Terms of Service'),
|
||||
'$displaytos' => ['displaytos', L10n::t('Display Terms of Service'), Config::get('system', 'tosdisplay'), L10n::t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')],
|
||||
|
@ -374,8 +377,8 @@ function admin_page_blocklist(App $a)
|
|||
];
|
||||
}
|
||||
}
|
||||
$t = get_markup_template('admin/blocklist.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/blocklist.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Server Blocklist'),
|
||||
'$intro' => L10n::t('This page can be used to define a black list of servers from the federated network that are not allowed to interact with your node. For all entered domains you should also give a reason why you have blocked the remote server.'),
|
||||
|
@ -489,8 +492,8 @@ function admin_page_contactblock(App $a)
|
|||
|
||||
$contacts = DBA::toArray($statement);
|
||||
|
||||
$t = get_markup_template('admin/contactblock.tpl');
|
||||
$o = replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/contactblock.tpl');
|
||||
$o = Renderer::replaceMacros($t, [
|
||||
// strings //
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Remote Contact Blocklist'),
|
||||
|
@ -531,9 +534,9 @@ function admin_page_contactblock(App $a)
|
|||
*/
|
||||
function admin_page_deleteitem(App $a)
|
||||
{
|
||||
$t = get_markup_template('admin/deleteitem.tpl');
|
||||
$t = Renderer::getMarkupTemplate('admin/deleteitem.tpl');
|
||||
|
||||
return replace_macros($t, [
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Delete Item'),
|
||||
'$submit' => L10n::t('Delete this Item'),
|
||||
|
@ -724,8 +727,8 @@ function admin_page_federation(App $a)
|
|||
$hint = L10n::t('The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here.');
|
||||
|
||||
// load the template, replace the macros and return the page content
|
||||
$t = get_markup_template('admin/federation.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/federation.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Federation Statistics'),
|
||||
'$intro' => $intro,
|
||||
|
@ -767,8 +770,8 @@ function admin_page_queue(App $a)
|
|||
}
|
||||
DBA::close($entries);
|
||||
|
||||
$t = get_markup_template('admin/queue.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/queue.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Inspect Queue'),
|
||||
'$count' => count($r),
|
||||
|
@ -818,8 +821,8 @@ function admin_page_workerqueue(App $a, $deferred)
|
|||
}
|
||||
DBA::close($entries);
|
||||
|
||||
$t = get_markup_template('admin/workerqueue.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/workerqueue.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => $sub_title,
|
||||
'$count' => count($r),
|
||||
|
@ -863,10 +866,10 @@ function admin_page_summary(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) {
|
||||
if (Config::get('system', 'dbupdate', DBStructure::UPDATE_NOT_CHECKED) == DBStructure::UPDATE_NOT_CHECKED) {
|
||||
DBStructure::update(false, true);
|
||||
}
|
||||
if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
|
||||
if (Config::get('system', 'dbupdate') == DBStructure::UPDATE_FAILED) {
|
||||
$showwarning = true;
|
||||
$warningtext[] = L10n::t('The database update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear.');
|
||||
}
|
||||
|
@ -910,7 +913,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();
|
||||
|
||||
|
@ -936,8 +939,8 @@ function admin_page_summary(App $a)
|
|||
'memory_limit' => ini_get('memory_limit')],
|
||||
'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
|
||||
|
||||
$t = get_markup_template('admin/summary.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/summary.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Summary'),
|
||||
'$queues' => $queues,
|
||||
|
@ -1447,8 +1450,8 @@ function admin_page_site(App $a)
|
|||
$optimize_max_tablesize = -1;
|
||||
}
|
||||
|
||||
$t = get_markup_template('admin/site.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/site.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Site'),
|
||||
'$submit' => L10n::t('Save Settings'),
|
||||
|
@ -1594,7 +1597,8 @@ function admin_page_dbsync(App $a)
|
|||
$retval = DBStructure::update(false, true);
|
||||
if ($retval === '') {
|
||||
$o .= L10n::t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
|
||||
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
|
||||
Config::set('database', 'last_successful_update', DB_UPDATE_VERSION);
|
||||
Config::set('database', 'last_successful_update_time', time());
|
||||
} else {
|
||||
$o .= L10n::t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />";
|
||||
}
|
||||
|
@ -1611,9 +1615,9 @@ function admin_page_dbsync(App $a)
|
|||
if (function_exists($func)) {
|
||||
$retval = $func();
|
||||
|
||||
if ($retval === UPDATE_FAILED) {
|
||||
if ($retval === Update::FAILED) {
|
||||
$o .= L10n::t("Executing %s failed with error: %s", $func, $retval);
|
||||
} elseif ($retval === UPDATE_SUCCESS) {
|
||||
} elseif ($retval === Update::SUCCESS) {
|
||||
$o .= L10n::t('Update %s was successfully applied.', $func);
|
||||
Config::set('database', $func, 'success');
|
||||
} else {
|
||||
|
@ -1641,13 +1645,13 @@ function admin_page_dbsync(App $a)
|
|||
}
|
||||
|
||||
if (!count($failed)) {
|
||||
$o = replace_macros(get_markup_template('structure_check.tpl'), [
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('structure_check.tpl'), [
|
||||
'$base' => System::baseUrl(true),
|
||||
'$banner' => L10n::t('No failed updates.'),
|
||||
'$check' => L10n::t('Check database structure'),
|
||||
]);
|
||||
} else {
|
||||
$o = replace_macros(get_markup_template('failed_updates.tpl'), [
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('failed_updates.tpl'), [
|
||||
'$base' => System::baseUrl(true),
|
||||
'$banner' => L10n::t('Failed Updates'),
|
||||
'$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'),
|
||||
|
@ -1908,8 +1912,8 @@ function admin_page_users(App $a)
|
|||
|
||||
$th_users = array_map(null, [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Type')], $valid_orders);
|
||||
|
||||
$t = get_markup_template('admin/users.tpl');
|
||||
$o = replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/users.tpl');
|
||||
$o = Renderer::replaceMacros($t, [
|
||||
// strings //
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Users'),
|
||||
|
@ -2024,9 +2028,9 @@ function admin_page_addons(App $a, array $addons_admin)
|
|||
$func($a, $admin_form);
|
||||
}
|
||||
|
||||
$t = get_markup_template('admin/addon_details.tpl');
|
||||
$t = Renderer::getMarkupTemplate('admin/addon_details.tpl');
|
||||
|
||||
return replace_macros($t, [
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Addons'),
|
||||
'$toggle' => L10n::t('Toggle'),
|
||||
|
@ -2085,8 +2089,8 @@ function admin_page_addons(App $a, array $addons_admin)
|
|||
}
|
||||
}
|
||||
|
||||
$t = get_markup_template('admin/addons.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/addons.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Addons'),
|
||||
'$submit' => L10n::t('Save Settings'),
|
||||
|
@ -2269,7 +2273,7 @@ function admin_page_themes(App $a)
|
|||
|
||||
$admin_form = '';
|
||||
if (is_file("view/theme/$theme/config.php")) {
|
||||
$orig_theme = $a->theme;
|
||||
$orig_theme = Renderer::$theme;
|
||||
$orig_page = $a->page;
|
||||
$orig_session_theme = $_SESSION['theme'];
|
||||
require_once "view/theme/$theme/theme.php";
|
||||
|
@ -2286,7 +2290,7 @@ function admin_page_themes(App $a)
|
|||
}
|
||||
|
||||
$_SESSION['theme'] = $orig_session_theme;
|
||||
$a->theme = $orig_theme;
|
||||
Renderer::$theme = $orig_theme;
|
||||
$a->page = $orig_page;
|
||||
}
|
||||
|
||||
|
@ -2295,8 +2299,8 @@ function admin_page_themes(App $a)
|
|||
$screenshot = null;
|
||||
}
|
||||
|
||||
$t = get_markup_template('admin/addon_details.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/addon_details.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Themes'),
|
||||
'$toggle' => L10n::t('Toggle'),
|
||||
|
@ -2339,8 +2343,8 @@ function admin_page_themes(App $a)
|
|||
$addons[] = [$th['name'], (($th['allowed']) ? "on" : "off"), Theme::getInfo($th['name'])];
|
||||
}
|
||||
|
||||
$t = get_markup_template('admin/addons.tpl');
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate('admin/addons.tpl');
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Themes'),
|
||||
'$submit' => L10n::t('Save Settings'),
|
||||
|
@ -2399,12 +2403,12 @@ function admin_page_logs_post(App $a)
|
|||
function admin_page_logs(App $a)
|
||||
{
|
||||
$log_choices = [
|
||||
LOGGER_WARNING => 'Warning',
|
||||
LOGGER_INFO => 'Info',
|
||||
LOGGER_TRACE => 'Trace',
|
||||
LOGGER_DEBUG => 'Debug',
|
||||
LOGGER_DATA => 'Data',
|
||||
LOGGER_ALL => 'All'
|
||||
Logger::WARNING => 'Warning',
|
||||
Logger::INFO => 'Info',
|
||||
Logger::TRACE => 'Trace',
|
||||
Logger::DEBUG => 'Debug',
|
||||
Logger::DATA => 'Data',
|
||||
Logger::ALL => 'All'
|
||||
];
|
||||
|
||||
if (ini_get('log_errors')) {
|
||||
|
@ -2413,9 +2417,9 @@ function admin_page_logs(App $a)
|
|||
$phplogenabled = L10n::t('PHP log currently disabled.');
|
||||
}
|
||||
|
||||
$t = get_markup_template('admin/logs.tpl');
|
||||
$t = Renderer::getMarkupTemplate('admin/logs.tpl');
|
||||
|
||||
return replace_macros($t, [
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('Logs'),
|
||||
'$submit' => L10n::t('Save Settings'),
|
||||
|
@ -2454,7 +2458,7 @@ function admin_page_logs(App $a)
|
|||
*/
|
||||
function admin_page_viewlogs(App $a)
|
||||
{
|
||||
$t = get_markup_template('admin/viewlogs.tpl');
|
||||
$t = Renderer::getMarkupTemplate('admin/viewlogs.tpl');
|
||||
$f = Config::get('system', 'logfile');
|
||||
$data = '';
|
||||
|
||||
|
@ -2482,7 +2486,7 @@ function admin_page_viewlogs(App $a)
|
|||
fclose($fp);
|
||||
}
|
||||
}
|
||||
return replace_macros($t, [
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$title' => L10n::t('Administration'),
|
||||
'$page' => L10n::t('View Logs'),
|
||||
'$data' => $data,
|
||||
|
@ -2499,7 +2503,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);
|
||||
|
||||
|
@ -2560,8 +2564,8 @@ function admin_page_features(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('admin/settings_features.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('admin/settings_features.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("admin_manage_features"),
|
||||
'$title' => L10n::t('Manage Additional Features'),
|
||||
'$features' => $arr,
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model;
|
||||
|
@ -98,9 +99,9 @@ function allfriends_content(App $a)
|
|||
|
||||
$tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
|
||||
|
||||
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
//'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])),
|
||||
'$tab_str' => $tab_str,
|
||||
'$contacts' => $entries,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Module\Login;
|
||||
|
@ -81,8 +82,8 @@ function api_content(App $a)
|
|||
killme();
|
||||
}
|
||||
|
||||
$tpl = get_markup_template("oauth_authorize_done.tpl");
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("oauth_authorize_done.tpl");
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Authorize application connection'),
|
||||
'$info' => L10n::t('Return to your app and insert this Securty Code:'),
|
||||
'$code' => $verifier,
|
||||
|
@ -103,8 +104,8 @@ function api_content(App $a)
|
|||
return "Invalid request. Unknown token.";
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('oauth_authorize.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('oauth_authorize.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Authorize application connection'),
|
||||
'$app' => $app,
|
||||
'$authorize' => L10n::t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'),
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
function apps_content()
|
||||
{
|
||||
|
@ -24,8 +25,8 @@ function apps_content()
|
|||
notice(L10n::t('No installed applications.') . EOL);
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('apps.tpl');
|
||||
return replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('apps.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$title' => $title,
|
||||
'$apps' => $apps,
|
||||
]);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
use Friendica\Content\Text;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
function visible_whitespace($s)
|
||||
{
|
||||
|
@ -139,8 +140,8 @@ function babel_content()
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('babel.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('babel.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$text' => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''],
|
||||
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
|
||||
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
|
||||
|
|
17
mod/cal.php
17
mod/cal.php
|
@ -12,6 +12,7 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -59,9 +60,9 @@ function cal_init(App $a)
|
|||
|
||||
$account_type = Contact::getAccountType($profile);
|
||||
|
||||
$tpl = get_markup_template("vcard-widget.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("vcard-widget.tpl");
|
||||
|
||||
$vcard_widget = replace_macros($tpl, [
|
||||
$vcard_widget = Renderer::replaceMacros($tpl, [
|
||||
'$name' => $profile['name'],
|
||||
'$photo' => $profile['photo'],
|
||||
'$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""),
|
||||
|
@ -88,8 +89,8 @@ function cal_content(App $a)
|
|||
// get the translation strings for the callendar
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
$htpl = get_markup_template('event_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($htpl, [
|
||||
$htpl = Renderer::getMarkupTemplate('event_head.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$module_url' => '/cal/' . $a->data['user']['nickname'],
|
||||
'$modparams' => 2,
|
||||
|
@ -248,12 +249,12 @@ function cal_content(App $a)
|
|||
|
||||
// links: array('href', 'text', 'extra css classes', 'title')
|
||||
if (x($_GET, 'id')) {
|
||||
$tpl = get_markup_template("event.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("event.tpl");
|
||||
} else {
|
||||
// if (Config::get('experimentals','new_calendar')==1){
|
||||
$tpl = get_markup_template("events_js.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("events_js.tpl");
|
||||
// } else {
|
||||
// $tpl = get_markup_template("events.tpl");
|
||||
// $tpl = Renderer::getMarkupTemplate("events.tpl");
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -267,7 +268,7 @@ function cal_content(App $a)
|
|||
$events[$key]['item'] = $event_item;
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$tabs' => $tabs,
|
||||
'$title' => L10n::t('Events'),
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module;
|
||||
|
@ -48,7 +49,7 @@ function common_content(App $a)
|
|||
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
|
||||
|
||||
if (DBA::isResult($contact)) {
|
||||
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
|
||||
$vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("vcard-widget.tpl"), [
|
||||
'$name' => htmlentities($contact['name']),
|
||||
'$photo' => $contact['photo'],
|
||||
'url' => 'contact/' . $cid
|
||||
|
@ -142,9 +143,9 @@ function common_content(App $a)
|
|||
$title = L10n::t('Common Friends');
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => $title,
|
||||
'$tab_str' => $tab_str,
|
||||
'$contacts' => $entries,
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\ACL;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -119,8 +120,8 @@ function community_content(App $a, $update = 0)
|
|||
];
|
||||
}
|
||||
|
||||
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||
$o .= replace_macros($tab_tpl, ['$tabs' => $tabs]);
|
||||
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
|
||||
$o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
|
||||
|
||||
Nav::setSelected('community');
|
||||
|
||||
|
@ -198,8 +199,8 @@ function community_content(App $a, $update = 0)
|
|||
$o .= $pager->renderMinimal(count($r));
|
||||
}
|
||||
|
||||
$t = get_markup_template("community.tpl");
|
||||
return replace_macros($t, [
|
||||
$t = Renderer::getMarkupTemplate("community.tpl");
|
||||
return Renderer::replaceMacros($t, [
|
||||
'$content' => $o,
|
||||
'$header' => '',
|
||||
'$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'),
|
||||
|
|
|
@ -7,14 +7,15 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
function credits_content()
|
||||
{
|
||||
/* fill the page with credits */
|
||||
$credits_string = file_get_contents('util/credits.txt');
|
||||
$names = explode("\n", htmlspecialchars($credits_string));
|
||||
$tpl = get_markup_template('credits.tpl');
|
||||
return replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('credits.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Credits'),
|
||||
'$thanks' => L10n::t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'),
|
||||
'$names' => $names,
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module;
|
||||
|
@ -78,7 +80,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']);
|
||||
}
|
||||
|
@ -135,8 +137,8 @@ function crepair_content(App $a)
|
|||
|
||||
$tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
|
||||
|
||||
$tpl = get_markup_template('crepair.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('crepair.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$tab_str' => $tab_str,
|
||||
'$warning' => $warning,
|
||||
'$info' => $info,
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\User;
|
||||
|
@ -163,7 +164,7 @@ function delegate_content(App $a)
|
|||
$parent_password = ['parent_password', L10n::t('Parent Password:'), '', L10n::t('Please enter the password of the parent account to legitimize your request.')];
|
||||
}
|
||||
|
||||
$o = replace_macros(get_markup_template('delegate.tpl'), [
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('delegate.tpl'), [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken('delegate'),
|
||||
'$parent_header' => L10n::t('Parent User'),
|
||||
'$parent_user' => $parent_user,
|
||||
|
|
|
@ -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`.*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -57,7 +59,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 +299,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",
|
||||
|
@ -513,8 +515,8 @@ function dfrn_request_content(App $a)
|
|||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
$tpl = get_markup_template("dfrn_req_confirm.tpl");
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("dfrn_req_confirm.tpl");
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$dfrn_url' => $dfrn_url,
|
||||
'$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
|
||||
'$hidethem' => L10n::t('Hide this contact'),
|
||||
|
@ -626,9 +628,9 @@ function dfrn_request_content(App $a)
|
|||
* it doesn't matter if they know you or not.
|
||||
*/
|
||||
if ($a->profile['page-flags'] == Contact::PAGE_NORMAL) {
|
||||
$tpl = get_markup_template('dfrn_request.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('dfrn_request.tpl');
|
||||
} else {
|
||||
$tpl = get_markup_template('auto_request.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
}
|
||||
|
||||
$page_desc = L10n::t("Please enter your 'Identity Address' from one of the following supported communications networks:");
|
||||
|
@ -638,7 +640,7 @@ function dfrn_request_content(App $a)
|
|||
get_server() . '/servers'
|
||||
);
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => L10n::t('Friend/Connection Request'),
|
||||
'$desc' => L10n::t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'),
|
||||
'$pls_answer' => L10n::t('Please answer the following:'),
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Content\Widget;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
|
@ -201,9 +202,9 @@ function directory_content(App $a)
|
|||
}
|
||||
DBA::close($r);
|
||||
|
||||
$tpl = get_markup_template('directory_header.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('directory_header.tpl');
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$search' => $search,
|
||||
'$globaldir' => L10n::t('Global Directory'),
|
||||
'$gdirpath' => $gdirpath,
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Content\Widget;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -249,8 +250,8 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
$entries[] = $entry;
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||
$o .= replace_macros($tpl,[
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl,[
|
||||
'title' => $header,
|
||||
'$contacts' => $entries,
|
||||
'$paginate' => $pager->renderFull($j->total),
|
||||
|
|
|
@ -10,7 +10,9 @@ 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\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -74,7 +76,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);
|
||||
}
|
||||
|
||||
|
@ -262,7 +264,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
$conversation = '';
|
||||
}
|
||||
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'),
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'),
|
||||
['$alternate' => $alternate,
|
||||
'$conversation' => $conversation]);
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
|
@ -39,19 +41,19 @@ function editpost_content(App $a)
|
|||
|
||||
$geotag = '';
|
||||
|
||||
$o .= replace_macros(get_markup_template("section_title.tpl"), [
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"), [
|
||||
'$title' => L10n::t('Edit post')
|
||||
]);
|
||||
|
||||
$tpl = get_markup_template('jot-header.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$ispublic' => ' ', // L10n::t('Visible to <strong>everybody</strong>'),
|
||||
'$geotag' => $geotag,
|
||||
'$nickname' => $a->user['nickname']
|
||||
]);
|
||||
|
||||
$tpl = get_markup_template("jot.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("jot.tpl");
|
||||
|
||||
if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
|
||||
$lockstate = 'lock';
|
||||
|
@ -84,7 +86,7 @@ function editpost_content(App $a)
|
|||
Addon::callHooks('jot_tool', $jotplugins);
|
||||
//Addon::callHooks('jot_networks', $jotnets);
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$is_edit' => true,
|
||||
'$return_path' => '/display/' . $item['guid'],
|
||||
'$action' => 'item',
|
||||
|
@ -118,7 +120,7 @@ function editpost_content(App $a)
|
|||
'$jotnets' => $jotnets,
|
||||
'$title' => htmlspecialchars($item['title']),
|
||||
'$placeholdertitle' => L10n::t('Set title'),
|
||||
'$category' => file_tag_file_to_list($item['file'], 'category'),
|
||||
'$category' => FileTag::fileToList($item['file'], 'category'),
|
||||
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
|
||||
'$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
|
||||
'$lockstate' => $lockstate,
|
||||
|
|
|
@ -9,6 +9,8 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Content\Widget\CalendarExport;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -47,7 +49,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;
|
||||
|
@ -224,8 +226,8 @@ function events_content(App $a)
|
|||
// get the translation strings for the callendar
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
$htpl = get_markup_template('event_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($htpl, [
|
||||
$htpl = Renderer::getMarkupTemplate('event_head.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$module_url' => '/events',
|
||||
'$modparams' => 1,
|
||||
|
@ -366,9 +368,9 @@ function events_content(App $a)
|
|||
}
|
||||
|
||||
if (!empty($_GET['id'])) {
|
||||
$tpl = get_markup_template("event.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("event.tpl");
|
||||
} else {
|
||||
$tpl = get_markup_template("events_js.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("events_js.tpl");
|
||||
}
|
||||
|
||||
// Get rid of dashes in key names, Smarty3 can't handle them
|
||||
|
@ -381,7 +383,7 @@ function events_content(App $a)
|
|||
$events[$key]['item'] = $event_item;
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$tabs' => $tabs,
|
||||
'$title' => L10n::t('Events'),
|
||||
|
@ -496,9 +498,9 @@ function events_content(App $a)
|
|||
$uri = '';
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('event_form.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('event_form.tpl');
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$post' => System::baseUrl() . '/events',
|
||||
'$eid' => $eid,
|
||||
'$cid' => $cid,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Object\Image;
|
||||
|
@ -93,9 +94,9 @@ function fbrowser_content(App $a)
|
|||
}
|
||||
$files = array_map("_map_files1", $r);
|
||||
|
||||
$tpl = get_markup_template($template_file);
|
||||
$tpl = Renderer::getMarkupTemplate($template_file);
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$type' => 'image',
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$path' => $path,
|
||||
|
@ -125,8 +126,8 @@ function fbrowser_content(App $a)
|
|||
$files = array_map("_map_files2", $files);
|
||||
|
||||
|
||||
$tpl = get_markup_template($template_file);
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate($template_file);
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$type' => 'file',
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$path' => [ [ "", L10n::t("Files")] ],
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\Feed;
|
||||
|
@ -43,8 +44,8 @@ function feedtest_content(App $a)
|
|||
];
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('feedtest.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('feedtest.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
|
||||
'$result' => $result
|
||||
]);
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Model\FileTag;
|
||||
|
||||
require_once 'include/items.php';
|
||||
|
||||
|
@ -17,19 +20,19 @@ 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
|
||||
file_tag_save_file(local_user(), $item_id, $term);
|
||||
FileTag::saveFile(local_user(), $item_id, $term);
|
||||
} else {
|
||||
// return filer dialog
|
||||
$filetags = PConfig::get(local_user(), 'system', 'filetags');
|
||||
$filetags = file_tag_file_to_list($filetags, 'file');
|
||||
$filetags = FileTag::fileToList($filetags, 'file');
|
||||
$filetags = explode(",", $filetags);
|
||||
|
||||
$tpl = get_markup_template("filer_dialog.tpl");
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("filer_dialog.tpl");
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$field' => ['term', L10n::t("Save to Folder:"), '', '', $filetags, L10n::t('- select -')],
|
||||
'$submit' => L10n::t('Save'),
|
||||
]);
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\FileTag;
|
||||
|
||||
function filerm_content(App $a) {
|
||||
|
||||
if (! local_user()) {
|
||||
function filerm_content(App $a)
|
||||
{
|
||||
if (! local_user())
|
||||
{
|
||||
killme();
|
||||
}
|
||||
|
||||
|
@ -13,19 +16,20 @@ function filerm_content(App $a) {
|
|||
$cat = unxmlify(trim($_GET['cat']));
|
||||
|
||||
$category = (($cat) ? true : false);
|
||||
if ($category) {
|
||||
|
||||
if ($category)
|
||||
{
|
||||
$term = $cat;
|
||||
}
|
||||
|
||||
$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);
|
||||
if ($item_id && strlen($term))
|
||||
{
|
||||
FileTag::unsaveFile(local_user(), $item_id, $term, $category);
|
||||
}
|
||||
|
||||
//$a->internalRedirect('network');
|
||||
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
|
@ -108,10 +109,10 @@ function follow_content(App $a)
|
|||
|
||||
if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($r)) {
|
||||
$request = $ret['request'];
|
||||
$tpl = get_markup_template('dfrn_request.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('dfrn_request.tpl');
|
||||
} else {
|
||||
$request = System::baseUrl() . '/follow';
|
||||
$tpl = get_markup_template('auto_request.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
}
|
||||
|
||||
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
|
||||
|
@ -144,7 +145,7 @@ function follow_content(App $a)
|
|||
|
||||
$header = L10n::t('Connect/Follow');
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => htmlentities($header),
|
||||
//'$photo' => ProxyUtils::proxifyUrl($ret['photo'], false, ProxyUtils::SIZE_SMALL),
|
||||
'$desc' => '',
|
||||
|
@ -187,7 +188,7 @@ function follow_content(App $a)
|
|||
}
|
||||
|
||||
if ($gcontact_id <> 0) {
|
||||
$o .= replace_macros(get_markup_template('section_title.tpl'),
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'),
|
||||
['$title' => L10n::t('Status Messages and Posts')]
|
||||
);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model;
|
||||
|
@ -97,7 +98,7 @@ function group_content(App $a) {
|
|||
$switchtotext = Config::get('system', 'groupedit_image_limit', 400);
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('group_edit.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('group_edit.tpl');
|
||||
|
||||
$context = [
|
||||
'$submit' => L10n::t('Save Group'),
|
||||
|
@ -105,7 +106,7 @@ function group_content(App $a) {
|
|||
];
|
||||
|
||||
if (($a->argc == 2) && ($a->argv[1] === 'new')) {
|
||||
return replace_macros($tpl, $context + [
|
||||
return Renderer::replaceMacros($tpl, $context + [
|
||||
'$title' => L10n::t('Create a group of contacts/friends.'),
|
||||
'$gname' => ['groupname', L10n::t('Group Name: '), '', ''],
|
||||
'$gid' => 'new',
|
||||
|
@ -214,8 +215,8 @@ function group_content(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$drop_tpl = get_markup_template('group_drop.tpl');
|
||||
$drop_txt = replace_macros($drop_tpl, [
|
||||
$drop_tpl = Renderer::getMarkupTemplate('group_drop.tpl');
|
||||
$drop_txt = Renderer::replaceMacros($drop_tpl, [
|
||||
'$id' => $group['id'],
|
||||
'$delete' => L10n::t('Delete Group'),
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("group_drop"),
|
||||
|
@ -306,11 +307,11 @@ function group_content(App $a) {
|
|||
$context['$shortmode'] = (($switchtotext && ($total > $switchtotext)) ? true : false);
|
||||
|
||||
if ($change) {
|
||||
$tpl = get_markup_template('groupeditor.tpl');
|
||||
echo replace_macros($tpl, $context);
|
||||
$tpl = Renderer::getMarkupTemplate('groupeditor.tpl');
|
||||
echo Renderer::replaceMacros($tpl, $context);
|
||||
killme();
|
||||
}
|
||||
|
||||
return replace_macros($tpl, $context);
|
||||
return Renderer::replaceMacros($tpl, $context);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
|
||||
function load_doc_file($s)
|
||||
|
@ -60,8 +61,8 @@ function help_content(App $a)
|
|||
|
||||
if (!strlen($text)) {
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
|
||||
$tpl = get_markup_template("404.tpl");
|
||||
return replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("404.tpl");
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$message' => L10n::t('Page not found.')
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
|
@ -53,8 +54,8 @@ function home_content(App $a) {
|
|||
Addon::callHooks("home_content",$content);
|
||||
|
||||
|
||||
$tpl = get_markup_template('home.tpl');
|
||||
return replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('home.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$defaultheader' => $defaultheader,
|
||||
'$customhome' => $customhome,
|
||||
'$login' => $login,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\Crypto;
|
||||
|
@ -21,8 +22,8 @@ function hostxrd_init(App $a)
|
|||
Config::set('system','site_pubkey', $res['pubkey']);
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('xrd_host.tpl');
|
||||
echo replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
|
||||
echo Renderer::replaceMacros($tpl, [
|
||||
'$zhost' => $a->getHostName(),
|
||||
'$zroot' => System::baseUrl(),
|
||||
'$domain' => System::baseUrl(),
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -110,8 +111,8 @@ function hovercard_content()
|
|||
'actions' => $actions,
|
||||
];
|
||||
if ($datatype == 'html') {
|
||||
$tpl = get_markup_template('hovercard.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('hovercard.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$profile' => $profile,
|
||||
]);
|
||||
|
||||
|
@ -133,7 +134,7 @@ function get_template_content($template, $root = '')
|
|||
{
|
||||
// We load the whole template system to get the filename.
|
||||
// Maybe we can do it a little bit smarter if I get time.
|
||||
$t = get_markup_template($template, $root);
|
||||
$t = Renderer::getMarkupTemplate($template, $root);
|
||||
$filename = $t->filename;
|
||||
|
||||
// Get the content of the template file
|
||||
|
|
271
mod/install.php
271
mod/install.php
|
@ -1,271 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file mod/install.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Install;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
$install_wizard_pass = 1;
|
||||
|
||||
function install_init(App $a) {
|
||||
|
||||
// $baseurl/install/testrwrite to test if rewite in .htaccess is working
|
||||
if ($a->argc == 2 && $a->argv[1] == "testrewrite") {
|
||||
echo "ok";
|
||||
killme();
|
||||
}
|
||||
|
||||
// We overwrite current theme css, because during install we could not have a working mod_rewrite
|
||||
// so we could not have a css at all. Here we set a static css file for the install procedure pages
|
||||
|
||||
$a->setConfigValue('system', 'value', '../install');
|
||||
$a->theme['stylesheet'] = System::baseUrl()."/view/install/style.css";
|
||||
|
||||
global $install_wizard_pass;
|
||||
if (x($_POST, 'pass')) {
|
||||
$install_wizard_pass = intval($_POST['pass']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function install_post(App $a) {
|
||||
global $install_wizard_pass;
|
||||
|
||||
switch($install_wizard_pass) {
|
||||
case 1:
|
||||
case 2:
|
||||
return;
|
||||
break; // just in case return don't return :)
|
||||
case 3:
|
||||
$dbhost = notags(trim($_POST['dbhost']));
|
||||
$dbuser = notags(trim($_POST['dbuser']));
|
||||
$dbpass = notags(trim($_POST['dbpass']));
|
||||
$dbdata = notags(trim($_POST['dbdata']));
|
||||
$phpath = notags(trim($_POST['phpath']));
|
||||
|
||||
require_once("include/dba.php");
|
||||
if (!DBA::connect($dbhost, $dbuser, $dbpass, $dbdata)) {
|
||||
$a->data['db_conn_failed'] = true;
|
||||
}
|
||||
|
||||
return;
|
||||
break;
|
||||
case 4:
|
||||
$urlpath = $a->getURLPath();
|
||||
$dbhost = notags(trim($_POST['dbhost']));
|
||||
$dbuser = notags(trim($_POST['dbuser']));
|
||||
$dbpass = notags(trim($_POST['dbpass']));
|
||||
$dbdata = notags(trim($_POST['dbdata']));
|
||||
$phpath = notags(trim($_POST['phpath']));
|
||||
$timezone = notags(trim($_POST['timezone']));
|
||||
$language = notags(trim($_POST['language']));
|
||||
$adminmail = notags(trim($_POST['adminmail']));
|
||||
|
||||
// connect to db
|
||||
DBA::connect($dbhost, $dbuser, $dbpass, $dbdata);
|
||||
|
||||
$install = new Install();
|
||||
|
||||
$errors = $install->createConfig($phpath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $a->getBasePath());
|
||||
|
||||
if ($errors !== true) {
|
||||
$a->data['data'] = $errors;
|
||||
return;
|
||||
}
|
||||
|
||||
$errors = DBStructure::update(false, true, true);
|
||||
|
||||
if ($errors) {
|
||||
$a->data['db_failed'] = $errors;
|
||||
} else {
|
||||
$a->data['db_installed'] = true;
|
||||
}
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function install_content(App $a) {
|
||||
|
||||
global $install_wizard_pass;
|
||||
$o = '';
|
||||
$wizard_status = "";
|
||||
$install_title = L10n::t('Friendica Communications Server - Setup');
|
||||
|
||||
if (x($a->data, 'db_conn_failed')) {
|
||||
$install_wizard_pass = 2;
|
||||
$wizard_status = L10n::t('Could not connect to database.');
|
||||
}
|
||||
if (x($a->data, 'db_create_failed')) {
|
||||
$install_wizard_pass = 2;
|
||||
$wizard_status = L10n::t('Could not create table.');
|
||||
}
|
||||
|
||||
$db_return_text = "";
|
||||
if (x($a->data, 'db_installed')) {
|
||||
$txt = '<p style="font-size: 130%;">';
|
||||
$txt .= L10n::t('Your Friendica site database has been installed.') . EOL;
|
||||
$db_return_text .= $txt;
|
||||
}
|
||||
|
||||
if (x($a->data, 'db_failed')) {
|
||||
$txt = L10n::t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL;
|
||||
$txt .= L10n::t('Please see the file "INSTALL.txt".') . EOL ."<hr>";
|
||||
$txt .= "<pre>".$a->data['db_failed'] . "</pre>". EOL;
|
||||
$db_return_text .= $txt;
|
||||
}
|
||||
|
||||
if (DBA::$connected) {
|
||||
$r = q("SELECT COUNT(*) as `total` FROM `user`");
|
||||
if (DBA::isResult($r) && $r[0]['total']) {
|
||||
$install_wizard_pass = 2;
|
||||
$wizard_status = L10n::t('Database already in use.');
|
||||
}
|
||||
}
|
||||
|
||||
if (x($a->data, 'txt') && strlen($a->data['txt'])) {
|
||||
$db_return_text .= manual_config($a);
|
||||
}
|
||||
|
||||
if ($db_return_text != "") {
|
||||
$tpl = get_markup_template('install.tpl');
|
||||
return replace_macros($tpl, [
|
||||
'$title' => $install_title,
|
||||
'$pass' => "",
|
||||
'$text' => $db_return_text . what_next(),
|
||||
]);
|
||||
}
|
||||
|
||||
switch ($install_wizard_pass) {
|
||||
case 1: { // System check
|
||||
|
||||
$phpath = defaults($_POST, 'phpath', 'php');
|
||||
|
||||
$install = new Install($phpath);
|
||||
|
||||
$status = $install->checkAll($a->getBasePath(), $a->getBaseURL());
|
||||
|
||||
$tpl = get_markup_template('install_checks.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
'$title' => $install_title,
|
||||
'$pass' => L10n::t('System check'),
|
||||
'$checks' => $install->getChecks(),
|
||||
'$passed' => $status,
|
||||
'$see_install' => L10n::t('Please see the file "INSTALL.txt".'),
|
||||
'$next' => L10n::t('Next'),
|
||||
'$reload' => L10n::t('Check again'),
|
||||
'$phpath' => $phpath,
|
||||
'$baseurl' => $a->getBaseURL(),
|
||||
]);
|
||||
return $o;
|
||||
}; break;
|
||||
|
||||
case 2: { // Database config
|
||||
|
||||
$dbhost = notags(trim(defaults($_POST, 'dbhost' , 'localhost')));
|
||||
$dbuser = notags(trim(defaults($_POST, 'dbuser' , '' )));
|
||||
$dbpass = notags(trim(defaults($_POST, 'dbpass' , '' )));
|
||||
$dbdata = notags(trim(defaults($_POST, 'dbdata' , '' )));
|
||||
$phpath = notags(trim(defaults($_POST, 'phpath' , '' )));
|
||||
$adminmail = notags(trim(defaults($_POST, 'adminmail', '' )));
|
||||
|
||||
$tpl = get_markup_template('install_db.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
'$title' => $install_title,
|
||||
'$pass' => L10n::t('Database connection'),
|
||||
'$info_01' => L10n::t('In order to install Friendica we need to know how to connect to your database.'),
|
||||
'$info_02' => L10n::t('Please contact your hosting provider or site administrator if you have questions about these settings.'),
|
||||
'$info_03' => L10n::t('The database you specify below should already exist. If it does not, please create it before continuing.'),
|
||||
|
||||
'$status' => $wizard_status,
|
||||
|
||||
'$dbhost' => ['dbhost', L10n::t('Database Server Name'), $dbhost, '', 'required'],
|
||||
'$dbuser' => ['dbuser', L10n::t('Database Login Name'), $dbuser, '', 'required', 'autofocus'],
|
||||
'$dbpass' => ['dbpass', L10n::t('Database Login Password'), $dbpass, L10n::t("For security reasons the password must not be empty"), 'required'],
|
||||
'$dbdata' => ['dbdata', L10n::t('Database Name'), $dbdata, '', 'required'],
|
||||
'$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
|
||||
|
||||
'$lbl_10' => L10n::t('Please select a default timezone for your website'),
|
||||
|
||||
'$baseurl' => $a->getBaseURL(),
|
||||
|
||||
'$phpath' => $phpath,
|
||||
|
||||
'$submit' => L10n::t('Submit'),
|
||||
]);
|
||||
return $o;
|
||||
}; break;
|
||||
case 3: { // Site settings
|
||||
$dbhost = ((x($_POST, 'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
|
||||
$dbuser = notags(trim($_POST['dbuser']));
|
||||
$dbpass = notags(trim($_POST['dbpass']));
|
||||
$dbdata = notags(trim($_POST['dbdata']));
|
||||
$phpath = notags(trim($_POST['phpath']));
|
||||
|
||||
$adminmail = notags(trim($_POST['adminmail']));
|
||||
$timezone = ((x($_POST, 'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
|
||||
/* Installed langs */
|
||||
$lang_choices = L10n::getAvailableLanguages();
|
||||
|
||||
$tpl = get_markup_template('install_settings.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
'$title' => $install_title,
|
||||
'$pass' => L10n::t('Site settings'),
|
||||
|
||||
'$status' => $wizard_status,
|
||||
|
||||
'$dbhost' => $dbhost,
|
||||
'$dbuser' => $dbuser,
|
||||
'$dbpass' => $dbpass,
|
||||
'$dbdata' => $dbdata,
|
||||
'$phpath' => $phpath,
|
||||
|
||||
'$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
|
||||
|
||||
|
||||
'$timezone' => Temporal::getTimezoneField('timezone', L10n::t('Please select a default timezone for your website'), $timezone, ''),
|
||||
'$language' => ['language', L10n::t('System Language:'), 'en', L10n::t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices],
|
||||
'$baseurl' => $a->getBaseURL(),
|
||||
|
||||
'$submit' => L10n::t('Submit'),
|
||||
|
||||
]);
|
||||
return $o;
|
||||
}; break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function manual_config(App $a) {
|
||||
$data = htmlentities($a->data['txt'],ENT_COMPAT, 'UTF-8');
|
||||
$o = L10n::t('The database configuration file "config/local.ini.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
|
||||
$o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
|
||||
return $o;
|
||||
}
|
||||
|
||||
function load_database_rem($v, $i) {
|
||||
$l = trim($i);
|
||||
if (strlen($l)>1 && ($l[0] == "-" || ($l[0] == "/" && $l[1] == "*"))) {
|
||||
return $v;
|
||||
} else {
|
||||
return $v."\n".$i;
|
||||
}
|
||||
}
|
||||
|
||||
function what_next() {
|
||||
$baseurl = System::baseUrl();
|
||||
return
|
||||
L10n::t('<h1>What next</h1>')
|
||||
."<p>".L10n::t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.')
|
||||
.L10n::t('Please see the file "INSTALL.txt".')
|
||||
."</p><p>"
|
||||
.L10n::t('Go to your new Friendica node <a href="%s/register">registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.', $baseurl)
|
||||
."</p>";
|
||||
}
|
|
@ -11,6 +11,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Protocol\Email;
|
||||
|
@ -110,7 +111,7 @@ function invite_content(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('invite.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('invite.tpl');
|
||||
$invonly = false;
|
||||
|
||||
if (Config::get('system', 'invitation_only')) {
|
||||
|
@ -140,7 +141,7 @@ function invite_content(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("send_invite"),
|
||||
'$title' => L10n::t('Send invitations'),
|
||||
'$recipients' => ['recipients', L10n::t('Enter email addresses, one per line:')],
|
||||
|
|
57
mod/item.php
57
mod/item.php
|
@ -22,12 +22,14 @@ 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;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\Email;
|
||||
|
@ -56,7 +58,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 +74,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 +132,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 +155,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;
|
||||
}
|
||||
}
|
||||
|
@ -290,17 +292,21 @@ function item_post(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($categories)) {
|
||||
if (!empty($categories))
|
||||
{
|
||||
// get the "fileas" tags for this post
|
||||
$filedas = file_tag_file_to_list($categories, 'file');
|
||||
$filedas = FileTag::fileToList($categories, 'file');
|
||||
}
|
||||
|
||||
// save old and new categories, so we can determine what needs to be deleted from pconfig
|
||||
$categories_old = $categories;
|
||||
$categories = file_tag_list_to_file(trim(defaults($_REQUEST, 'category', '')), 'category');
|
||||
$categories = FileTag::listToFile(trim(defaults($_REQUEST, 'category', '')), 'category');
|
||||
$categories_new = $categories;
|
||||
if (!empty($filedas)) {
|
||||
|
||||
if (!empty($filedas))
|
||||
{
|
||||
// append the fileas stuff to the new categories list
|
||||
$categories .= file_tag_list_to_file($filedas, 'file');
|
||||
$categories .= FileTag::listToFile($filedas, 'file');
|
||||
}
|
||||
|
||||
// get contact info for poster
|
||||
|
@ -669,7 +675,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 +683,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);
|
||||
}
|
||||
|
@ -711,10 +717,10 @@ function item_post(App $a) {
|
|||
Item::update($fields, ['id' => $post_id]);
|
||||
|
||||
// update filetags in pconfig
|
||||
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
|
||||
FileTag::updatePconfig($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,19 +742,19 @@ 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);
|
||||
}
|
||||
|
||||
// update filetags in pconfig
|
||||
file_tag_update_pconfig($uid, $categories_old, $categories_new, 'category');
|
||||
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
|
||||
|
||||
// These notifications are sent if someone else is commenting other your wall
|
||||
if ($parent) {
|
||||
|
@ -833,7 +839,13 @@ 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');
|
||||
// When we are doing some forum posting via ! we have to start the notifier manually.
|
||||
// These kind of posts don't initiate the notifier call in the item class.
|
||||
if ($only_to_forum) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", $notify_type, $post_id);
|
||||
}
|
||||
|
||||
Logger::log('post_complete');
|
||||
|
||||
if ($api_source) {
|
||||
return $post_id;
|
||||
|
@ -861,7 +873,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();
|
||||
|
@ -875,11 +887,16 @@ function item_content(App $a)
|
|||
|
||||
$o = '';
|
||||
|
||||
if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
|
||||
if (($a->argc >= 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
|
||||
if ($a->isAjax()) {
|
||||
$o = Item::deleteForUser(['id' => $a->argv[2]], local_user());
|
||||
} else {
|
||||
$o = drop_item($a->argv[2]);
|
||||
if (!empty($a->argv[3])) {
|
||||
$o = drop_item($a->argv[2], $a->argv[3]);
|
||||
}
|
||||
else {
|
||||
$o = drop_item($a->argv[2]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($a->isAjax()) {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\User;
|
||||
|
@ -115,8 +116,8 @@ function lostpass_content(App $a)
|
|||
|
||||
function lostpass_form()
|
||||
{
|
||||
$tpl = get_markup_template('lostpass.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('lostpass.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Forgot your Password?'),
|
||||
'$desc' => L10n::t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'),
|
||||
'$name' => L10n::t('Nickname or Email: '),
|
||||
|
@ -134,8 +135,8 @@ function lostpass_generate_password($user)
|
|||
$new_password = User::generateNewPassword();
|
||||
$result = User::updatePassword($user['uid'], $new_password);
|
||||
if (DBA::isResult($result)) {
|
||||
$tpl = get_markup_template('pwdreset.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('pwdreset.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$lbl1' => L10n::t('Password Reset'),
|
||||
'$lbl2' => L10n::t('Your password has been reset as requested.'),
|
||||
'$lbl3' => L10n::t('Your new password is'),
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
function maintenance_content(App $a)
|
||||
{
|
||||
|
@ -20,7 +21,7 @@ function maintenance_content(App $a)
|
|||
header('Status: 503 Service Temporarily Unavailable');
|
||||
header('Retry-After: 600');
|
||||
|
||||
return replace_macros(get_markup_template('maintenance.tpl'), [
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('maintenance.tpl'), [
|
||||
'$sysdown' => L10n::t('System down for maintenance'),
|
||||
'$reason' => $reason
|
||||
]);
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Authentication;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
|
@ -176,7 +177,7 @@ function manage_content(App $a) {
|
|||
$identities[$key]['notifications'] = $notifications;
|
||||
}
|
||||
|
||||
$o = replace_macros(get_markup_template('manage.tpl'), [
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('manage.tpl'), [
|
||||
'$title' => L10n::t('Manage Identities and/or Pages'),
|
||||
'$desc' => L10n::t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'),
|
||||
'$choose' => L10n::t('Select an identity to manage: '),
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
function manifest_content(App $a) {
|
||||
|
||||
$tpl = get_markup_template('manifest.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('manifest.tpl');
|
||||
|
||||
header('Content-type: application/manifest+json');
|
||||
|
||||
|
@ -15,7 +16,7 @@ function manifest_content(App $a) {
|
|||
$touch_icon = 'images/friendica-128.png';
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$touch_icon' => $touch_icon,
|
||||
'$title' => Config::get('config', 'sitename', 'Friendica'),
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -112,9 +113,9 @@ function match_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Profile Match'),
|
||||
'$contacts' => $entries,
|
||||
'$paginate' => $pager->renderFull($j->total)
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Content\Smilies;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -36,15 +37,15 @@ function message_init(App $a)
|
|||
'accesskey' => 'm',
|
||||
];
|
||||
|
||||
$tpl = get_markup_template('message_side.tpl');
|
||||
$a->page['aside'] = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('message_side.tpl');
|
||||
$a->page['aside'] = Renderer::replaceMacros($tpl, [
|
||||
'$tabs' => $tabs,
|
||||
'$new' => $new,
|
||||
]);
|
||||
$base = System::baseUrl();
|
||||
|
||||
$head_tpl = get_markup_template('message-head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($head_tpl, [
|
||||
$head_tpl = Renderer::getMarkupTemplate('message-head.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl, [
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
'$base' => $base
|
||||
]);
|
||||
|
@ -104,7 +105,7 @@ function message_content(App $a)
|
|||
|
||||
$myprofile = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
||||
|
||||
$tpl = get_markup_template('mail_head.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('mail_head.tpl');
|
||||
if ($a->argc > 1 && $a->argv[1] == 'new') {
|
||||
$button = [
|
||||
'label' => L10n::t('Discard'),
|
||||
|
@ -119,7 +120,7 @@ function message_content(App $a)
|
|||
'accesskey' => 'm',
|
||||
];
|
||||
}
|
||||
$header = replace_macros($tpl, [
|
||||
$header = Renderer::replaceMacros($tpl, [
|
||||
'$messages' => L10n::t('Messages'),
|
||||
'$button' => $button,
|
||||
]);
|
||||
|
@ -143,7 +144,7 @@ function message_content(App $a)
|
|||
}
|
||||
|
||||
//$a->page['aside'] = '';
|
||||
return replace_macros(get_markup_template('confirm.tpl'), [
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
|
||||
'$method' => 'get',
|
||||
'$message' => L10n::t('Do you really want to delete this message?'),
|
||||
'$extra_inputs' => $inputs,
|
||||
|
@ -198,8 +199,8 @@ function message_content(App $a)
|
|||
if (($a->argc > 1) && ($a->argv[1] === 'new')) {
|
||||
$o .= $header;
|
||||
|
||||
$tpl = get_markup_template('msg-header.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('msg-header.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
'$nickname' => $a->user['nickname'],
|
||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
||||
|
@ -243,8 +244,8 @@ function message_content(App $a)
|
|||
// the ugly select box
|
||||
$select = ACL::getMessageContactSelectHTML('messageto', 'message-to-select', $preselect, 4, 10);
|
||||
|
||||
$tpl = get_markup_template('prv_message.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('prv_message.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$header' => L10n::t('Send Private Message'),
|
||||
'$to' => L10n::t('To:'),
|
||||
'$showinputs' => 'true',
|
||||
|
@ -338,8 +339,8 @@ function message_content(App $a)
|
|||
intval(local_user())
|
||||
);
|
||||
|
||||
$tpl = get_markup_template('msg-header.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('msg-header.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
'$nickname' => $a->user['nickname'],
|
||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
||||
|
@ -398,8 +399,8 @@ function message_content(App $a)
|
|||
$select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />';
|
||||
$parent = '<input type="hidden" name="replyto" value="' . $message['parent-uri'] . '" />';
|
||||
|
||||
$tpl = get_markup_template('mail_display.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('mail_display.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$thread_id' => $a->argv[1],
|
||||
'$thread_subject' => $message['title'],
|
||||
'$thread_seen' => $seen,
|
||||
|
@ -453,7 +454,7 @@ function render_messages(array $msg, $t)
|
|||
{
|
||||
$a = get_app();
|
||||
|
||||
$tpl = get_markup_template($t);
|
||||
$tpl = Renderer::getMarkupTemplate($t);
|
||||
$rslt = '';
|
||||
|
||||
$myprofile = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
||||
|
@ -478,7 +479,7 @@ function render_messages(array $msg, $t)
|
|||
$from_photo = (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']);
|
||||
}
|
||||
|
||||
$rslt .= replace_macros($tpl, [
|
||||
$rslt .= Renderer::replaceMacros($tpl, [
|
||||
'$id' => $rr['id'],
|
||||
'$from_name' => $participants,
|
||||
'$from_url' => Contact::magicLink($rr['url']),
|
||||
|
|
|
@ -15,8 +15,10 @@ 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\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -199,8 +201,8 @@ function saved_searches($search)
|
|||
];
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('saved_searches_aside.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('saved_searches_aside.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Saved Searches'),
|
||||
'$add' => L10n::t('add'),
|
||||
'$searchbox' => search($search, 'netsearch-box', $srchurl, true),
|
||||
|
@ -652,7 +654,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
info(L10n::t('Group is empty'));
|
||||
}
|
||||
|
||||
$o = replace_macros(get_markup_template('section_title.tpl'), [
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
|
||||
'$title' => L10n::t('Group: %s', $group['name'])
|
||||
]) . $o;
|
||||
} elseif ($cid) {
|
||||
|
@ -673,7 +675,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
|
||||
$entries[0]['account_type'] = Contact::getAccountType($contact);
|
||||
|
||||
$o = replace_macros(get_markup_template('viewcontact_template.tpl'), [
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('viewcontact_template.tpl'), [
|
||||
'contacts' => $entries,
|
||||
'id' => 'network',
|
||||
]) . $o;
|
||||
|
@ -871,7 +873,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;
|
||||
|
@ -1031,9 +1033,9 @@ function network_tabs(App $a)
|
|||
$arr = ['tabs' => $tabs];
|
||||
Addon::callHooks('network_tabs', $arr);
|
||||
|
||||
$tpl = get_markup_template('common_tabs.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
|
||||
|
||||
return replace_macros($tpl, ['$tabs' => $arr['tabs']]);
|
||||
return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
|
||||
|
||||
// --- end item filter tabs
|
||||
}
|
||||
|
@ -1057,8 +1059,8 @@ function network_infinite_scroll_head(App $a, &$htmlhead)
|
|||
if (PConfig::get(local_user(), 'system', 'infinite_scroll')
|
||||
&& defaults($_GET, 'mode', '') != 'minimal'
|
||||
) {
|
||||
$tpl = get_markup_template('infinite_scroll_head.tpl');
|
||||
$htmlhead .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
|
||||
$htmlhead .= Renderer::replaceMacros($tpl, [
|
||||
'$pageno' => $pager->getPage(),
|
||||
'$reload_uri' => $pager->getBaseQueryString()
|
||||
]);
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Module\Login;
|
||||
|
@ -132,7 +133,7 @@ function notifications_content(App $a)
|
|||
System::jsonExit($notifs);
|
||||
}
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
$notif_tpl = Renderer::getMarkupTemplate('notifications.tpl');
|
||||
|
||||
$notif_show_lnk = [
|
||||
'href' => ($show ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all' ),
|
||||
|
@ -141,8 +142,8 @@ function notifications_content(App $a)
|
|||
|
||||
// Process the data for template creation
|
||||
if (defaults($notifs, 'ident', '') === 'introductions') {
|
||||
$sugg = get_markup_template('suggestions.tpl');
|
||||
$tpl = get_markup_template('intros.tpl');
|
||||
$sugg = Renderer::getMarkupTemplate('suggestions.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('intros.tpl');
|
||||
|
||||
// The link to switch between ignored and normal connection requests
|
||||
$notif_show_lnk = [
|
||||
|
@ -158,7 +159,7 @@ function notifications_content(App $a)
|
|||
// We have to distinguish between these two because they use different data.
|
||||
switch ($notif['label']) {
|
||||
case 'friend_suggestion':
|
||||
$notif_content[] = replace_macros($sugg, [
|
||||
$notif_content[] = Renderer::replaceMacros($sugg, [
|
||||
'$type' => $notif['label'],
|
||||
'$str_notifytype' => L10n::t('Notification type:'),
|
||||
'$notify_type'=> $notif['notify_type'],
|
||||
|
@ -208,8 +209,8 @@ function notifications_content(App $a)
|
|||
$helptext3 = L10n::t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $notif['name']);
|
||||
}
|
||||
|
||||
$dfrn_tpl = get_markup_template('netfriend.tpl');
|
||||
$dfrn_text = replace_macros($dfrn_tpl, [
|
||||
$dfrn_tpl = Renderer::getMarkupTemplate('netfriend.tpl');
|
||||
$dfrn_text = Renderer::replaceMacros($dfrn_tpl, [
|
||||
'$intro_id' => $notif['intro_id'],
|
||||
'$friend_selected' => $friend_selected,
|
||||
'$fan_selected'=> $fan_selected,
|
||||
|
@ -234,7 +235,7 @@ function notifications_content(App $a)
|
|||
$discard = '';
|
||||
}
|
||||
|
||||
$notif_content[] = replace_macros($tpl, [
|
||||
$notif_content[] = Renderer::replaceMacros($tpl, [
|
||||
'$type' => $notif['label'],
|
||||
'$header' => htmlentities($header),
|
||||
'$str_notifytype' => L10n::t('Notification type:'),
|
||||
|
@ -293,9 +294,9 @@ function notifications_content(App $a)
|
|||
'notify' => 'notify.tpl',
|
||||
];
|
||||
|
||||
$tpl_notif = get_markup_template($notification_templates[$notif['label']]);
|
||||
$tpl_notif = Renderer::getMarkupTemplate($notification_templates[$notif['label']]);
|
||||
|
||||
$notif_content[] = replace_macros($tpl_notif, [
|
||||
$notif_content[] = Renderer::replaceMacros($tpl_notif, [
|
||||
'$item_label' => $notif['label'],
|
||||
'$item_link' => $notif['link'],
|
||||
'$item_image' => $notif['image'],
|
||||
|
@ -310,7 +311,7 @@ function notifications_content(App $a)
|
|||
$notif_nocontent = L10n::t('No more %s notifications.', $notifs['ident']);
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl, [
|
||||
$o .= Renderer::replaceMacros($notif_tpl, [
|
||||
'$notif_header' => $notif_header,
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -59,14 +60,14 @@ function notify_content(App $a)
|
|||
|
||||
$nm = new NotificationsManager();
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
$notif_tpl = Renderer::getMarkupTemplate('notifications.tpl');
|
||||
|
||||
$not_tpl = get_markup_template('notify.tpl');
|
||||
$not_tpl = Renderer::getMarkupTemplate('notify.tpl');
|
||||
|
||||
$r = $nm->getAll(['seen'=>0]);
|
||||
if (DBA::isResult($r) > 0) {
|
||||
foreach ($r as $it) {
|
||||
$notif_content .= replace_macros($not_tpl, [
|
||||
$notif_content .= Renderer::replaceMacros($not_tpl, [
|
||||
'$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'],
|
||||
'$item_image' => $it['photo'],
|
||||
'$item_text' => strip_tags(BBCode::convert($it['msg'])),
|
||||
|
@ -77,7 +78,7 @@ function notify_content(App $a)
|
|||
$notif_content .= L10n::t('No more system notifications.');
|
||||
}
|
||||
|
||||
$o = replace_macros($notif_tpl, [
|
||||
$o = Renderer::replaceMacros($notif_tpl, [
|
||||
'$notif_header' => L10n::t('System Notifications'),
|
||||
'$tabs' => false, // $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -11,9 +12,9 @@ use Friendica\Util\Network;
|
|||
function oexchange_init(App $a) {
|
||||
|
||||
if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
|
||||
$tpl = get_markup_template('oexchange_xrd.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl');
|
||||
|
||||
$o = replace_macros($tpl, ['$base' => System::baseUrl()]);
|
||||
$o = Renderer::replaceMacros($tpl, ['$base' => System::baseUrl()]);
|
||||
echo $o;
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
|
||||
function opensearch_content(App $a) {
|
||||
|
||||
$tpl = get_markup_template('opensearch.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('opensearch.tpl');
|
||||
|
||||
header("Content-type: application/opensearchdescription+xml");
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$nodename' => $a->getHostName(),
|
||||
]);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -12,6 +12,8 @@ use Friendica\Core\ACL;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -61,9 +63,9 @@ function photos_init(App $a) {
|
|||
|
||||
$account_type = Contact::getAccountType($profile);
|
||||
|
||||
$tpl = get_markup_template("vcard-widget.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("vcard-widget.tpl");
|
||||
|
||||
$vcard_widget = replace_macros($tpl, [
|
||||
$vcard_widget = Renderer::replaceMacros($tpl, [
|
||||
'$name' => $profile['name'],
|
||||
'$photo' => $profile['photo'],
|
||||
'$addr' => defaults($profile, 'addr', ''),
|
||||
|
@ -108,7 +110,7 @@ function photos_init(App $a) {
|
|||
}
|
||||
|
||||
if ($ret['success']) {
|
||||
$photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'), [
|
||||
$photo_albums_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('photo_albums.tpl'), [
|
||||
'$nick' => $a->data['user']['nickname'],
|
||||
'$title' => L10n::t('Photo Albums'),
|
||||
'$recent' => L10n::t('Recent Photos'),
|
||||
|
@ -129,9 +131,9 @@ function photos_init(App $a) {
|
|||
$a->page['aside'] .= $photo_albums_widget;
|
||||
}
|
||||
|
||||
$tpl = get_markup_template("photos_head.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("photos_head.tpl");
|
||||
|
||||
$a->page['htmlhead'] .= replace_macros($tpl,[
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[
|
||||
'$ispublic' => L10n::t('everybody')
|
||||
]);
|
||||
}
|
||||
|
@ -141,9 +143,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 +191,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();
|
||||
}
|
||||
|
||||
|
@ -245,7 +247,7 @@ function photos_post(App $a)
|
|||
['name' => 'albumname', 'value' => $_POST['albumname']],
|
||||
];
|
||||
|
||||
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
|
||||
$a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
|
||||
'$method' => 'post',
|
||||
'$message' => L10n::t('Do you really want to delete this photo album and all its photos?'),
|
||||
'$extra_inputs' => $extra_inputs,
|
||||
|
@ -317,7 +319,7 @@ function photos_post(App $a)
|
|||
if (!empty($_REQUEST['confirm'])) {
|
||||
$drop_url = $a->query_string;
|
||||
|
||||
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
|
||||
$a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
|
||||
'$method' => 'post',
|
||||
'$message' => L10n::t('Do you really want to delete this photo?'),
|
||||
'$extra_inputs' => [],
|
||||
|
@ -379,7 +381,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 +708,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 +801,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 +821,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 +857,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();
|
||||
}
|
||||
|
@ -1083,18 +1085,18 @@ function photos_content(App $a)
|
|||
|
||||
Addon::callHooks('photo_upload_form',$ret);
|
||||
|
||||
$default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), []);
|
||||
$default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), [
|
||||
$default_upload_box = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_box.tpl'), []);
|
||||
$default_upload_submit = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_submit.tpl'), [
|
||||
'$submit' => L10n::t('Submit'),
|
||||
]);
|
||||
|
||||
$usage_message = '';
|
||||
|
||||
$tpl = get_markup_template('photos_upload.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('photos_upload.tpl');
|
||||
|
||||
$aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML($a->user));
|
||||
|
||||
$o .= replace_macros($tpl,[
|
||||
$o .= Renderer::replaceMacros($tpl,[
|
||||
'$pagename' => L10n::t('Upload Photos'),
|
||||
'$sessid' => session_id(),
|
||||
'$usage' => $usage_message,
|
||||
|
@ -1164,11 +1166,11 @@ function photos_content(App $a)
|
|||
if ($cmd === 'edit') {
|
||||
if (($album !== L10n::t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== L10n::t('Contact Photos'))) {
|
||||
if ($can_post) {
|
||||
$edit_tpl = get_markup_template('album_edit.tpl');
|
||||
$edit_tpl = Renderer::getMarkupTemplate('album_edit.tpl');
|
||||
|
||||
$album_e = $album;
|
||||
|
||||
$o .= replace_macros($edit_tpl,[
|
||||
$o .= Renderer::replaceMacros($edit_tpl,[
|
||||
'$nametext' => L10n::t('New album name: '),
|
||||
'$nickname' => $a->data['user']['nickname'],
|
||||
'$album' => $album_e,
|
||||
|
@ -1218,8 +1220,8 @@ function photos_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('photo_album.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('photo_album.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$photos' => $photos,
|
||||
'$album' => $album,
|
||||
'$can_post' => $can_post,
|
||||
|
@ -1340,8 +1342,8 @@ function photos_content(App $a)
|
|||
}
|
||||
|
||||
if ($cmd === 'edit') {
|
||||
$tpl = get_markup_template('photo_edit_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl,[
|
||||
$tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[
|
||||
'$prevlink' => $prevlink,
|
||||
'$nextlink' => $nextlink
|
||||
]);
|
||||
|
@ -1427,13 +1429,13 @@ function photos_content(App $a)
|
|||
|
||||
$edit = Null;
|
||||
if ($cmd === 'edit' && $can_post) {
|
||||
$edit_tpl = get_markup_template('photo_edit.tpl');
|
||||
$edit_tpl = Renderer::getMarkupTemplate('photo_edit.tpl');
|
||||
|
||||
$album_e = $ph[0]['album'];
|
||||
$caption_e = $ph[0]['desc'];
|
||||
$aclselect_e = ACL::getFullSelectorHTML($a->user, false, $ph[0]);
|
||||
|
||||
$edit = replace_macros($edit_tpl, [
|
||||
$edit = Renderer::replaceMacros($edit_tpl, [
|
||||
'$id' => $ph[0]['id'],
|
||||
'$album' => ['albname', L10n::t('New album name'), $album_e,''],
|
||||
'$caption' => ['desc', L10n::t('Caption'), $caption_e, ''],
|
||||
|
@ -1466,13 +1468,13 @@ function photos_content(App $a)
|
|||
$responses = '';
|
||||
|
||||
if (count($linked_items)) {
|
||||
$cmnt_tpl = get_markup_template('comment_item.tpl');
|
||||
$tpl = get_markup_template('photo_item.tpl');
|
||||
$cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('photo_item.tpl');
|
||||
$return_path = $a->cmd;
|
||||
|
||||
if ($can_post || Security::canWriteToUserWall($owner_uid)) {
|
||||
$like_tpl = get_markup_template('like_noshare.tpl');
|
||||
$likebuttons = replace_macros($like_tpl, [
|
||||
$like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl');
|
||||
$likebuttons = Renderer::replaceMacros($like_tpl, [
|
||||
'$id' => $link_item['id'],
|
||||
'$likethis' => L10n::t("I like this \x28toggle\x29"),
|
||||
'$nolike' => (Feature::isEnabled(local_user(), 'dislike') ? L10n::t("I don't like this \x28toggle\x29") : ''),
|
||||
|
@ -1483,7 +1485,7 @@ function photos_content(App $a)
|
|||
|
||||
if (!DBA::isResult($items)) {
|
||||
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
|
||||
$comments .= replace_macros($cmnt_tpl, [
|
||||
$comments .= Renderer::replaceMacros($cmnt_tpl, [
|
||||
'$return_path' => '',
|
||||
'$jsreload' => $return_path,
|
||||
'$id' => $link_item['id'],
|
||||
|
@ -1522,7 +1524,7 @@ function photos_content(App $a)
|
|||
}
|
||||
|
||||
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
|
||||
$comments .= replace_macros($cmnt_tpl,[
|
||||
$comments .= Renderer::replaceMacros($cmnt_tpl,[
|
||||
'$return_path' => '',
|
||||
'$jsreload' => $return_path,
|
||||
'$id' => $link_item['id'],
|
||||
|
@ -1567,7 +1569,7 @@ function photos_content(App $a)
|
|||
$title_e = $item['title'];
|
||||
$body_e = BBCode::convert($item['body']);
|
||||
|
||||
$comments .= replace_macros($template,[
|
||||
$comments .= Renderer::replaceMacros($template,[
|
||||
'$id' => $item['id'],
|
||||
'$profile_url' => $profile_url,
|
||||
'$name' => $item['author-name'],
|
||||
|
@ -1582,7 +1584,7 @@ function photos_content(App $a)
|
|||
]);
|
||||
|
||||
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
|
||||
$comments .= replace_macros($cmnt_tpl, [
|
||||
$comments .= Renderer::replaceMacros($cmnt_tpl, [
|
||||
'$return_path' => '',
|
||||
'$jsreload' => $return_path,
|
||||
'$id' => $item['item_id'],
|
||||
|
@ -1610,8 +1612,8 @@ function photos_content(App $a)
|
|||
$paginate = $pager->renderFull($total);
|
||||
}
|
||||
|
||||
$photo_tpl = get_markup_template('photo_view.tpl');
|
||||
$o .= replace_macros($photo_tpl, [
|
||||
$photo_tpl = Renderer::getMarkupTemplate('photo_view.tpl');
|
||||
$o .= Renderer::replaceMacros($photo_tpl, [
|
||||
'$id' => $ph[0]['id'],
|
||||
'$album' => [$album_link, $ph[0]['album']],
|
||||
'$tools' => $tools,
|
||||
|
@ -1702,8 +1704,8 @@ function photos_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('photos_recent.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('photos_recent.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Recent Photos'),
|
||||
'$can_post' => $can_post,
|
||||
'$upload' => [L10n::t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'],
|
||||
|
|
14
mod/poco.php
14
mod/poco.php
|
@ -8,7 +8,9 @@ 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\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
|
@ -121,7 +123,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 +134,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 +146,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 +159,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,11 +371,11 @@ 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');
|
||||
echo replace_macros(get_markup_template('poco_xml.tpl'), array_xmlify(['$response' => $ret]));
|
||||
echo Renderer::replaceMacros(Renderer::getMarkupTemplate('poco_xml.tpl'), array_xmlify(['$response' => $ret]));
|
||||
killme();
|
||||
}
|
||||
if ($format === 'json') {
|
||||
|
|
14
mod/poke.php
14
mod/poke.php
|
@ -16,6 +16,8 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -53,7 +55,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 +64,7 @@ function poke_init(App $a)
|
|||
);
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
logger('poke: no contact ' . $contact_id);
|
||||
Logger::log('poke: no contact ' . $contact_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -158,8 +160,8 @@ function poke_content(App $a)
|
|||
|
||||
$base = System::baseUrl();
|
||||
|
||||
$head_tpl = get_markup_template('poke_head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($head_tpl,[
|
||||
$head_tpl = Renderer::getMarkupTemplate('poke_head.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl,[
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
'$base' => $base
|
||||
]);
|
||||
|
@ -177,9 +179,9 @@ function poke_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('poke_content.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('poke_content.tpl');
|
||||
|
||||
$o = replace_macros($tpl,[
|
||||
$o = Renderer::replaceMacros($tpl,[
|
||||
'$title' => L10n::t('Poke/Prod'),
|
||||
'$desc' => L10n::t('poke, prod or do other things to somebody'),
|
||||
'$clabel' => L10n::t('Recipient'),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -238,9 +239,9 @@ function profile_photo_content(App $a)
|
|||
);
|
||||
|
||||
if (empty($imagecrop)) {
|
||||
$tpl = get_markup_template('profile_photo.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('profile_photo.tpl');
|
||||
|
||||
$o = replace_macros($tpl,
|
||||
$o = Renderer::replaceMacros($tpl,
|
||||
[
|
||||
'$user' => $a->user['nickname'],
|
||||
'$lbl_upfile' => L10n::t('Upload File:'),
|
||||
|
@ -256,8 +257,8 @@ function profile_photo_content(App $a)
|
|||
return $o;
|
||||
} else {
|
||||
$filename = $imagecrop['hash'] . '-' . $imagecrop['resolution'] . '.' . $imagecrop['ext'];
|
||||
$tpl = get_markup_template("cropbody.tpl");
|
||||
$o = replace_macros($tpl,
|
||||
$tpl = Renderer::getMarkupTemplate("cropbody.tpl");
|
||||
$o = Renderer::replaceMacros($tpl,
|
||||
[
|
||||
'$filename' => $filename,
|
||||
'$profile' => (isset($_REQUEST['profile']) ? intval($_REQUEST['profile']) : 0),
|
||||
|
@ -318,7 +319,7 @@ function profile_photo_crop_ui_head(App $a, Image $image)
|
|||
}
|
||||
}
|
||||
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []);
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate("crophead.tpl"), []);
|
||||
|
||||
$imagecrop = [
|
||||
'hash' => $hash,
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -526,12 +527,12 @@ function profiles_content(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), [
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
]);
|
||||
|
||||
$opt_tpl = get_markup_template("profile-hide-friends.tpl");
|
||||
$hide_friends = replace_macros($opt_tpl,[
|
||||
$opt_tpl = Renderer::getMarkupTemplate("profile-hide-friends.tpl");
|
||||
$hide_friends = Renderer::replaceMacros($opt_tpl,[
|
||||
'$yesno' => [
|
||||
'hide-friends', //Name
|
||||
L10n::t('Hide contacts and friends:'), //Label
|
||||
|
@ -552,8 +553,8 @@ function profiles_content(App $a) {
|
|||
$detailled_profile = (PConfig::get(local_user(), 'system', 'detailled_profile') AND $personal_account);
|
||||
|
||||
$is_default = (($r[0]['is-default']) ? 1 : 0);
|
||||
$tpl = get_markup_template("profile_edit.tpl");
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("profile_edit.tpl");
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$personal_account' => $personal_account,
|
||||
'$detailled_profile' => $detailled_profile,
|
||||
|
||||
|
@ -663,11 +664,11 @@ function profiles_content(App $a) {
|
|||
|
||||
if (DBA::isResult($r)) {
|
||||
|
||||
$tpl = get_markup_template('profile_entry.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('profile_entry.tpl');
|
||||
|
||||
$profiles = '';
|
||||
foreach ($r as $rr) {
|
||||
$profiles .= replace_macros($tpl, [
|
||||
$profiles .= Renderer::replaceMacros($tpl, [
|
||||
'$photo' => $a->removeBaseURL($rr['thumb']),
|
||||
'$id' => $rr['id'],
|
||||
'$alt' => L10n::t('Profile Image'),
|
||||
|
@ -677,8 +678,8 @@ function profiles_content(App $a) {
|
|||
]);
|
||||
}
|
||||
|
||||
$tpl_header = get_markup_template('profile_listing_header.tpl');
|
||||
$o .= replace_macros($tpl_header,[
|
||||
$tpl_header = Renderer::getMarkupTemplate('profile_listing_header.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl_header,[
|
||||
'$header' => L10n::t('Edit/Manage Profiles'),
|
||||
'$chg_photo' => L10n::t('Change profile photo'),
|
||||
'$cr_new' => L10n::t('Create New Profile'),
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@ 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\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Model;
|
||||
|
@ -186,7 +188,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;
|
||||
}
|
||||
|
@ -227,8 +229,8 @@ function register_content(App $a)
|
|||
if (Config::get('system', 'publish_all')) {
|
||||
$profile_publish = '<input type="hidden" name="profile_publish_reg" value="1" />';
|
||||
} else {
|
||||
$publish_tpl = get_markup_template("profile_publish.tpl");
|
||||
$profile_publish = replace_macros($publish_tpl, [
|
||||
$publish_tpl = Renderer::getMarkupTemplate("profile_publish.tpl");
|
||||
$profile_publish = Renderer::replaceMacros($publish_tpl, [
|
||||
'$instance' => 'reg',
|
||||
'$pubdesc' => L10n::t('Include your profile in member directory?'),
|
||||
'$yes_selected' => '',
|
||||
|
@ -243,7 +245,7 @@ function register_content(App $a)
|
|||
|
||||
$license = '';
|
||||
|
||||
$tpl = get_markup_template("register.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("register.tpl");
|
||||
|
||||
$arr = ['template' => $tpl];
|
||||
|
||||
|
@ -253,7 +255,7 @@ function register_content(App $a)
|
|||
|
||||
$tos = new Tos();
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$oidhtml' => $oidhtml,
|
||||
'$invitations' => Config::get('system', 'invitation_only'),
|
||||
'$permonly' => intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\User;
|
||||
|
@ -74,8 +75,8 @@ function removeme_content(App $a)
|
|||
|
||||
$_SESSION['remove_account_verify'] = $hash;
|
||||
|
||||
$tpl = get_markup_template('removeme.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('removeme.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$basedir' => $a->getBaseURL(),
|
||||
'$hash' => $hash,
|
||||
'$title' => L10n::t('Remove My Account'),
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -42,9 +44,9 @@ function search_saved_searches() {
|
|||
}
|
||||
|
||||
|
||||
$tpl = get_markup_template("saved_searches_aside.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("saved_searches_aside.tpl");
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Saved Searches'),
|
||||
'$add' => '',
|
||||
'$searchbox' => '',
|
||||
|
@ -157,7 +159,7 @@ function search_content(App $a) {
|
|||
}
|
||||
|
||||
// contruct a wrapper for the search header
|
||||
$o = replace_macros(get_markup_template("content_wrapper.tpl"),[
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate("content_wrapper.tpl"),[
|
||||
'name' => "search-header",
|
||||
'$title' => L10n::t("Search"),
|
||||
'$title_size' => 3,
|
||||
|
@ -204,7 +206,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 +229,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('%',?,'%')",
|
||||
|
@ -250,16 +252,16 @@ function search_content(App $a) {
|
|||
$title = L10n::t('Results for: %s', $search);
|
||||
}
|
||||
|
||||
$o .= replace_macros(get_markup_template("section_title.tpl"),[
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"),[
|
||||
'$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;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@ 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\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Core\Worker;
|
||||
|
@ -48,8 +50,8 @@ function settings_init(App $a)
|
|||
|
||||
// These lines provide the javascript needed by the acl selector
|
||||
|
||||
$tpl = get_markup_template('settings/head.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('settings/head.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$ispublic' => L10n::t('everybody')
|
||||
]);
|
||||
|
||||
|
@ -128,8 +130,8 @@ function settings_init(App $a)
|
|||
];
|
||||
|
||||
|
||||
$tabtpl = get_markup_template("generic_links_widget.tpl");
|
||||
$a->page['aside'] = replace_macros($tabtpl, [
|
||||
$tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
|
||||
$a->page['aside'] = Renderer::replaceMacros($tabtpl, [
|
||||
'$title' => L10n::t('Settings'),
|
||||
'$class' => 'settings-widget',
|
||||
'$items' => $tabs,
|
||||
|
@ -269,7 +271,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 +549,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);
|
||||
|
@ -670,8 +672,8 @@ function settings_content(App $a)
|
|||
|
||||
if (($a->argc > 1) && ($a->argv[1] === 'oauth')) {
|
||||
if (($a->argc > 2) && ($a->argv[2] === 'add')) {
|
||||
$tpl = get_markup_template('settings/oauth_edit.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('settings/oauth_edit.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"),
|
||||
'$title' => L10n::t('Add application'),
|
||||
'$submit' => L10n::t('Save Settings'),
|
||||
|
@ -696,8 +698,8 @@ function settings_content(App $a)
|
|||
}
|
||||
$app = $r[0];
|
||||
|
||||
$tpl = get_markup_template('settings/oauth_edit.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('settings/oauth_edit.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"),
|
||||
'$title' => L10n::t('Add application'),
|
||||
'$submit' => L10n::t('Update'),
|
||||
|
@ -728,8 +730,8 @@ function settings_content(App $a)
|
|||
local_user());
|
||||
|
||||
|
||||
$tpl = get_markup_template('settings/oauth.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('settings/oauth.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"),
|
||||
'$baseurl' => $a->getBaseURL(true),
|
||||
'$title' => L10n::t('Connected Apps'),
|
||||
|
@ -755,8 +757,8 @@ function settings_content(App $a)
|
|||
Addon::callHooks('addon_settings', $settings_addons);
|
||||
|
||||
|
||||
$tpl = get_markup_template('settings/addons.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('settings/addons.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_addon"),
|
||||
'$title' => L10n::t('Addon Settings'),
|
||||
'$settings_addons' => $settings_addons
|
||||
|
@ -776,8 +778,8 @@ function settings_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('settings/features.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('settings/features.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_features"),
|
||||
'$title' => L10n::t('Additional Features'),
|
||||
'$features' => $arr,
|
||||
|
@ -832,11 +834,11 @@ function settings_content(App $a)
|
|||
$mail_chk = ((DBA::isResult($r)) ? $r[0]['last_check'] : DBA::NULL_DATETIME);
|
||||
|
||||
|
||||
$tpl = get_markup_template('settings/connectors.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('settings/connectors.tpl');
|
||||
|
||||
$mail_disabled_message = (($mail_disabled) ? L10n::t('Email access is disabled on this site.') : '');
|
||||
|
||||
$o .= replace_macros($tpl, [
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_connectors"),
|
||||
|
||||
'$title' => L10n::t('Social Networks'),
|
||||
|
@ -954,8 +956,8 @@ function settings_content(App $a)
|
|||
$theme_config = theme_content($a);
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('settings/display.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('settings/display.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$ptitle' => L10n::t('Display Settings'),
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_display"),
|
||||
'$submit' => L10n::t('Save Settings'),
|
||||
|
@ -1030,9 +1032,9 @@ function settings_content(App $a)
|
|||
($a->user['account-type'] != Contact::ACCOUNT_TYPE_COMMUNITY))
|
||||
$a->user['account-type'] = Contact::ACCOUNT_TYPE_COMMUNITY;
|
||||
|
||||
$pageset_tpl = get_markup_template('settings/pagetypes.tpl');
|
||||
$pageset_tpl = Renderer::getMarkupTemplate('settings/pagetypes.tpl');
|
||||
|
||||
$pagetype = replace_macros($pageset_tpl, [
|
||||
$pagetype = Renderer::replaceMacros($pageset_tpl, [
|
||||
'$account_types' => L10n::t("Account Types"),
|
||||
'$user' => L10n::t("Personal Page Subtypes"),
|
||||
'$community' => L10n::t("Community Forum Subtypes"),
|
||||
|
@ -1089,44 +1091,44 @@ function settings_content(App $a)
|
|||
$openid_field = ['openid_url', L10n::t('OpenID:'), $openid, L10n::t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "", "url"];
|
||||
}
|
||||
|
||||
$opt_tpl = get_markup_template("field_yesno.tpl");
|
||||
$opt_tpl = Renderer::getMarkupTemplate("field_yesno.tpl");
|
||||
if (Config::get('system', 'publish_all')) {
|
||||
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
|
||||
} else {
|
||||
$profile_in_dir = replace_macros($opt_tpl, [
|
||||
$profile_in_dir = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', System::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
|
||||
]);
|
||||
}
|
||||
|
||||
if (strlen(Config::get('system', 'directory'))) {
|
||||
$profile_in_net_dir = replace_macros($opt_tpl, [
|
||||
$profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['profile_in_netdirectory', L10n::t('Publish your default profile in the global social directory?'), $profile['net-publish'], L10n::t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', Config::get('system', 'directory'), Config::get('system', 'directory')), [L10n::t('No'), L10n::t('Yes')]]
|
||||
]);
|
||||
} else {
|
||||
$profile_in_net_dir = '';
|
||||
}
|
||||
|
||||
$hide_friends = replace_macros($opt_tpl, [
|
||||
$hide_friends = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['hide-friends', L10n::t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], L10n::t('Your contact list won\'t be shown in your default profile page. You can decide to show your contact list separately for each additional profile you create'), [L10n::t('No'), L10n::t('Yes')]],
|
||||
]);
|
||||
|
||||
$hide_wall = replace_macros($opt_tpl, [
|
||||
$hide_wall = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['hidewall', L10n::t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], L10n::t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.'), [L10n::t('No'), L10n::t('Yes')]],
|
||||
]);
|
||||
|
||||
$blockwall = replace_macros($opt_tpl, [
|
||||
$blockwall = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['blockwall', L10n::t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), L10n::t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts'), [L10n::t('No'), L10n::t('Yes')]],
|
||||
]);
|
||||
|
||||
$blocktags = replace_macros($opt_tpl, [
|
||||
$blocktags = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['blocktags', L10n::t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), L10n::t('Your contacts can add additional tags to your posts.'), [L10n::t('No'), L10n::t('Yes')]],
|
||||
]);
|
||||
|
||||
$suggestme = replace_macros($opt_tpl, [
|
||||
$suggestme = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['suggestme', L10n::t('Allow us to suggest you as a potential friend to new members?'), $suggestme, L10n::t('If you like, Friendica may suggest new members to add you as a contact.'), [L10n::t('No'), L10n::t('Yes')]],
|
||||
]);
|
||||
|
||||
$unkmail = replace_macros($opt_tpl, [
|
||||
$unkmail = Renderer::replaceMacros($opt_tpl, [
|
||||
'$field' => ['unkmail', L10n::t('Permit unknown people to send you private mail?'), $unkmail, L10n::t('Friendica network users may send you private messages even if they are not in your contact list.'), [L10n::t('No'), L10n::t('Yes')]],
|
||||
]);
|
||||
|
||||
|
@ -1134,14 +1136,14 @@ function settings_content(App $a)
|
|||
info(L10n::t('Profile is <strong>not published</strong>.') . EOL);
|
||||
}
|
||||
|
||||
$tpl_addr = get_markup_template('settings/nick_set.tpl');
|
||||
$tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl');
|
||||
|
||||
$prof_addr = replace_macros($tpl_addr,[
|
||||
$prof_addr = Renderer::replaceMacros($tpl_addr,[
|
||||
'$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname),
|
||||
'$basepath' => $a->getHostName()
|
||||
]);
|
||||
|
||||
$stpl = get_markup_template('settings/settings.tpl');
|
||||
$stpl = Renderer::getMarkupTemplate('settings/settings.tpl');
|
||||
|
||||
$expire_arr = [
|
||||
'days' => ['expire', L10n::t("Automatically expire posts after this many days:"), $expire, L10n::t('If empty, posts will not expire. Expired posts will be deleted')],
|
||||
|
@ -1180,7 +1182,7 @@ function settings_content(App $a)
|
|||
$lang_choices = L10n::getAvailableLanguages();
|
||||
|
||||
/// @TODO Fix indending (or so)
|
||||
$o .= replace_macros($stpl, [
|
||||
$o .= Renderer::replaceMacros($stpl, [
|
||||
'$ptitle' => L10n::t('Account Settings'),
|
||||
|
||||
'$submit' => L10n::t('Save Settings'),
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -33,7 +34,7 @@ function suggest_init(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
|
||||
$a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
|
||||
'$method' => 'get',
|
||||
'$message' => L10n::t('Do you really want to delete this suggestion?'),
|
||||
'$extra_inputs' => $inputs,
|
||||
|
@ -111,9 +112,9 @@ function suggest_content(App $a)
|
|||
$entries[] = $entry;
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
||||
$o .= replace_macros($tpl,[
|
||||
$o .= Renderer::replaceMacros($tpl,[
|
||||
'$title' => L10n::t('Friend Suggestions'),
|
||||
'$contacts' => $entries,
|
||||
]);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
|
@ -46,8 +47,8 @@ function uexport_content(App $a) {
|
|||
];
|
||||
Addon::callHooks('uexport_options', $options);
|
||||
|
||||
$tpl = get_markup_template("uexport.tpl");
|
||||
return replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("uexport.tpl");
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$title' => L10n::t('Export personal data'),
|
||||
'$options' => $options
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\UserImport;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
function uimport_post(App $a)
|
||||
{
|
||||
|
@ -33,7 +35,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;
|
||||
}
|
||||
|
@ -47,8 +49,8 @@ function uimport_content(App $a)
|
|||
unset($_SESSION['mobile-theme']);
|
||||
}
|
||||
|
||||
$tpl = get_markup_template("uimport.tpl");
|
||||
return replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("uimport.tpl");
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$regbutt' => L10n::t('Import'),
|
||||
'$import' => [
|
||||
'title' => L10n::t("Move account"),
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -99,7 +100,7 @@ function unfollow_content(App $a)
|
|||
}
|
||||
|
||||
$request = System::baseUrl() . '/unfollow';
|
||||
$tpl = get_markup_template('auto_request.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
|
||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
|
||||
|
@ -114,7 +115,7 @@ function unfollow_content(App $a)
|
|||
|
||||
$header = L10n::t('Disconnect/Unfollow');
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => htmlentities($header),
|
||||
'$desc' => '',
|
||||
'$pls_answer' => '',
|
||||
|
@ -144,7 +145,7 @@ function unfollow_content(App $a)
|
|||
$a->page['aside'] = '';
|
||||
Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url']));
|
||||
|
||||
$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
|
||||
|
||||
// Show last public posts
|
||||
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -50,9 +51,9 @@ function videos_init(App $a)
|
|||
|
||||
$account_type = Contact::getAccountType($profile);
|
||||
|
||||
$tpl = get_markup_template("vcard-widget.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate("vcard-widget.tpl");
|
||||
|
||||
$vcard_widget = replace_macros($tpl, [
|
||||
$vcard_widget = Renderer::replaceMacros($tpl, [
|
||||
'$name' => $profile['name'],
|
||||
'$photo' => $profile['photo'],
|
||||
'$addr' => defaults($profile, 'addr', ''),
|
||||
|
@ -102,8 +103,8 @@ function videos_init(App $a)
|
|||
|
||||
$a->page['aside'] .= $vcard_widget;
|
||||
|
||||
$tpl = get_markup_template("videos_head.tpl");
|
||||
$a->page['htmlhead'] .= replace_macros($tpl,[
|
||||
$tpl = Renderer::getMarkupTemplate("videos_head.tpl");
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[
|
||||
'$baseurl' => System::baseUrl(),
|
||||
]);
|
||||
}
|
||||
|
@ -128,7 +129,7 @@ function videos_post(App $a)
|
|||
|
||||
$drop_url = $a->query_string;
|
||||
|
||||
$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
|
||||
$a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
|
||||
'$method' => 'post',
|
||||
'$message' => L10n::t('Do you really want to delete this video?'),
|
||||
'$extra_inputs' => [
|
||||
|
@ -381,8 +382,8 @@ function videos_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('videos_recent.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('videos_recent.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Recent Videos'),
|
||||
'$can_post' => $can_post,
|
||||
'$upload' => [L10n::t('Upload New Videos'), System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/upload'],
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -124,8 +125,8 @@ function viewcontacts_content(App $a)
|
|||
}
|
||||
|
||||
|
||||
$tpl = get_markup_template("viewcontact_template.tpl");
|
||||
$o .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("viewcontact_template.tpl");
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Contacts'),
|
||||
'$contacts' => $contacts,
|
||||
'$paginate' => $pager->renderFull($total),
|
||||
|
|
|
@ -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,8 +187,8 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
$filetype = $imagedata['mime'];
|
||||
}
|
||||
|
||||
logger("File upload src: " . $src . " - filename: " . $filename .
|
||||
" - size: " . $filesize . " - type: " . $filetype, LOGGER_DEBUG);
|
||||
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]);
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Mail;
|
||||
|
@ -30,7 +32,7 @@ function wallmessage_post(App $a) {
|
|||
);
|
||||
|
||||
if (! DBA::isResult($r)) {
|
||||
logger('wallmessage: no recipient');
|
||||
Logger::log('wallmessage: no recipient');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -93,7 +95,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;
|
||||
}
|
||||
|
||||
|
@ -113,15 +115,15 @@ function wallmessage_content(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('wallmsg-header.tpl');
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(true),
|
||||
'$nickname' => $user['nickname'],
|
||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
||||
]);
|
||||
|
||||
$tpl = get_markup_template('wallmessage.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('wallmessage.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => L10n::t('Send Private Message'),
|
||||
'$subheader' => L10n::t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']),
|
||||
'$to' => L10n::t('To:'),
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Protocol\Salmon;
|
||||
|
@ -105,9 +106,9 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r)
|
|||
header('Access-Control-Allow-Origin: *');
|
||||
header("Content-type: text/xml");
|
||||
|
||||
$tpl = get_markup_template('xrd_person.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('xrd_person.tpl');
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$nick' => $r['nickname'],
|
||||
'$accturi' => $uri,
|
||||
'$alias' => $alias,
|
||||
|
|
179
src/App.php
179
src/App.php
|
@ -136,40 +136,8 @@ class App
|
|||
$this->footerScripts[] = trim($url, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief An array for all theme-controllable parameters
|
||||
*
|
||||
* Mostly unimplemented yet. Only options 'template_engine' and
|
||||
* beyond are used.
|
||||
*/
|
||||
public $theme = [
|
||||
'sourcename' => '',
|
||||
'videowidth' => 425,
|
||||
'videoheight' => 350,
|
||||
'force_max_items' => 0,
|
||||
'stylesheet' => '',
|
||||
'template_engine' => 'smarty3',
|
||||
];
|
||||
|
||||
/**
|
||||
* @brief An array of registered template engines ('name'=>'class name')
|
||||
*/
|
||||
public $template_engines = [];
|
||||
|
||||
/**
|
||||
* @brief An array of instanced template engines ('name'=>'instance')
|
||||
*/
|
||||
public $template_engine_instance = [];
|
||||
public $process_id;
|
||||
public $queue;
|
||||
private $ldelim = [
|
||||
'internal' => '',
|
||||
'smarty3' => '{{'
|
||||
];
|
||||
private $rdelim = [
|
||||
'internal' => '',
|
||||
'smarty3' => '}}'
|
||||
];
|
||||
private $scheme;
|
||||
private $hostname;
|
||||
|
||||
|
@ -309,7 +277,7 @@ class App
|
|||
$this->isAjax = strtolower(defaults($_SERVER, 'HTTP_X_REQUESTED_WITH', '')) == 'xmlhttprequest';
|
||||
|
||||
// Register template engines
|
||||
$this->registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||
Core\Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -505,6 +473,7 @@ class App
|
|||
$relative_script_path = defaults($_SERVER, 'REDIRECT_URI' , $relative_script_path);
|
||||
$relative_script_path = defaults($_SERVER, 'REDIRECT_SCRIPT_URL', $relative_script_path);
|
||||
$relative_script_path = defaults($_SERVER, 'SCRIPT_URL' , $relative_script_path);
|
||||
$relative_script_path = defaults($_SERVER, 'REQUEST_URI' , $relative_script_path);
|
||||
|
||||
$this->urlPath = $this->getConfigValue('system', 'urlpath');
|
||||
|
||||
|
@ -751,8 +720,8 @@ class App
|
|||
$this->page['title'] = $this->config['sitename'];
|
||||
}
|
||||
|
||||
if (!empty($this->theme['stylesheet'])) {
|
||||
$stylesheet = $this->theme['stylesheet'];
|
||||
if (!empty(Core\Renderer::$theme['stylesheet'])) {
|
||||
$stylesheet = Core\Renderer::$theme['stylesheet'];
|
||||
} else {
|
||||
$stylesheet = $this->getCurrentThemeStylesheetPath();
|
||||
}
|
||||
|
@ -771,12 +740,12 @@ class App
|
|||
|
||||
Core\Addon::callHooks('head', $this->page['htmlhead']);
|
||||
|
||||
$tpl = get_markup_template('head.tpl');
|
||||
$tpl = Core\Renderer::getMarkupTemplate('head.tpl');
|
||||
/* put the head template at the beginning of page['htmlhead']
|
||||
* since the code added by the modules frequently depends on it
|
||||
* being first
|
||||
*/
|
||||
$this->page['htmlhead'] = replace_macros($tpl, [
|
||||
$this->page['htmlhead'] = Core\Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => $this->getBaseURL(),
|
||||
'$local_user' => local_user(),
|
||||
'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
|
||||
|
@ -822,7 +791,7 @@ class App
|
|||
} else {
|
||||
$link = 'toggle_mobile?off=1&address=' . curPageURL();
|
||||
}
|
||||
$this->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), [
|
||||
$this->page['footer'] .= Core\Renderer::replaceMacros(Core\Renderer::getMarkupTemplate("toggle_mobile_footer.tpl"), [
|
||||
'$toggle_link' => $link,
|
||||
'$toggle_text' => Core\L10n::t('toggle mobile')
|
||||
]);
|
||||
|
@ -830,8 +799,8 @@ class App
|
|||
|
||||
Core\Addon::callHooks('footer', $this->page['footer']);
|
||||
|
||||
$tpl = get_markup_template('footer.tpl');
|
||||
$this->page['footer'] = replace_macros($tpl, [
|
||||
$tpl = Core\Renderer::getMarkupTemplate('footer.tpl');
|
||||
$this->page['footer'] = Core\Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => $this->getBaseURL(),
|
||||
'$footerScripts' => $this->footerScripts,
|
||||
]) . $this->page['footer'];
|
||||
|
@ -859,102 +828,6 @@ class App
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register template engine class
|
||||
*
|
||||
* @param string $class
|
||||
*/
|
||||
private function registerTemplateEngine($class)
|
||||
{
|
||||
$v = get_class_vars($class);
|
||||
if (!empty($v['name'])) {
|
||||
$name = $v['name'];
|
||||
$this->template_engines[$name] = $class;
|
||||
} else {
|
||||
echo "template engine <tt>$class</tt> cannot be registered without a name.\n";
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return template engine instance.
|
||||
*
|
||||
* If $name is not defined, return engine defined by theme,
|
||||
* or default
|
||||
*
|
||||
* @return object Template Engine instance
|
||||
*/
|
||||
public function getTemplateEngine()
|
||||
{
|
||||
$template_engine = defaults($this->theme, 'template_engine', 'smarty3');
|
||||
|
||||
if (isset($this->template_engines[$template_engine])) {
|
||||
if (isset($this->template_engine_instance[$template_engine])) {
|
||||
return $this->template_engine_instance[$template_engine];
|
||||
} else {
|
||||
$class = $this->template_engines[$template_engine];
|
||||
$obj = new $class;
|
||||
$this->template_engine_instance[$template_engine] = $obj;
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
|
||||
echo "template engine <tt>$template_engine</tt> is not registered!\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the active template engine.
|
||||
*
|
||||
* @return string the active template engine
|
||||
*/
|
||||
public function getActiveTemplateEngine()
|
||||
{
|
||||
return $this->theme['template_engine'];
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the active template engine
|
||||
*
|
||||
* @param string $engine the template engine (default is Smarty3)
|
||||
*/
|
||||
public function setActiveTemplateEngine($engine = 'smarty3')
|
||||
{
|
||||
$this->theme['template_engine'] = $engine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the right delimiter for a template engine
|
||||
*
|
||||
* Currently:
|
||||
* Internal = ''
|
||||
* Smarty3 = '{{'
|
||||
*
|
||||
* @param string $engine The template engine (default is Smarty3)
|
||||
*
|
||||
* @return string the right delimiter
|
||||
*/
|
||||
public function getTemplateLeftDelimiter($engine = 'smarty3')
|
||||
{
|
||||
return $this->ldelim[$engine];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the left delimiter for a template engine
|
||||
*
|
||||
* Currently:
|
||||
* Internal = ''
|
||||
* Smarty3 = '}}'
|
||||
*
|
||||
* @param string $engine The template engine (default is Smarty3)
|
||||
*
|
||||
* @return string the left delimiter
|
||||
*/
|
||||
public function getTemplateRightDelimiter($engine = 'smarty3')
|
||||
{
|
||||
return $this->rdelim[$engine];
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a timestamp for a value - f.e. a call
|
||||
* Necessary for profiling Friendica
|
||||
|
@ -1100,10 +973,10 @@ class App
|
|||
|
||||
$processlist = DBA::processlist();
|
||||
if ($processlist['list'] != '') {
|
||||
logger('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG);
|
||||
Core\Logger::log('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], Core\Logger::DEBUG);
|
||||
|
||||
if ($processlist['amount'] > $max_processes) {
|
||||
logger('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', LOGGER_DEBUG);
|
||||
Core\Logger::log('Processcheck: Maximum number of processes for ' . $process . ' tasks (' . $max_processes . ') reached.', Core\Logger::DEBUG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1149,7 +1022,7 @@ class App
|
|||
$reached = ($free < $min_memory);
|
||||
|
||||
if ($reached) {
|
||||
logger('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, LOGGER_DEBUG);
|
||||
Core\Logger::log('Minimal memory reached: ' . $free . '/' . $meminfo['MemTotal'] . ' - limit ' . $min_memory, Core\Logger::DEBUG);
|
||||
}
|
||||
|
||||
return $reached;
|
||||
|
@ -1179,7 +1052,7 @@ class App
|
|||
$load = Core\System::currentLoad();
|
||||
if ($load) {
|
||||
if (intval($load) > $maxsysload) {
|
||||
logger('system: load ' . $load . ' for ' . $process . ' tasks (' . $maxsysload . ') too high.');
|
||||
Core\Logger::log('system: load ' . $load . ' for ' . $process . ' tasks (' . $maxsysload . ') too high.');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1221,7 +1094,7 @@ class App
|
|||
$resource = proc_open($cmdline . ' &', [], $foo, $this->getBasePath());
|
||||
}
|
||||
if (!is_resource($resource)) {
|
||||
logger('We got no resource for command ' . $cmdline, LOGGER_DEBUG);
|
||||
Core\Logger::log('We got no resource for command ' . $cmdline, Core\Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
proc_close($resource);
|
||||
|
@ -1252,27 +1125,27 @@ class App
|
|||
public static function isDirectoryUsable($directory, $check_writable = true)
|
||||
{
|
||||
if ($directory == '') {
|
||||
logger('Directory is empty. This shouldn\'t happen.', LOGGER_DEBUG);
|
||||
Core\Logger::log('Directory is empty. This shouldn\'t happen.', Core\Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!file_exists($directory)) {
|
||||
logger('Path "' . $directory . '" does not exist for user ' . self::getSystemUser(), LOGGER_DEBUG);
|
||||
Core\Logger::log('Path "' . $directory . '" does not exist for user ' . self::getSystemUser(), Core\Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_file($directory)) {
|
||||
logger('Path "' . $directory . '" is a file for user ' . self::getSystemUser(), LOGGER_DEBUG);
|
||||
Core\Logger::log('Path "' . $directory . '" is a file for user ' . self::getSystemUser(), Core\Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_dir($directory)) {
|
||||
logger('Path "' . $directory . '" is not a directory for user ' . self::getSystemUser(), LOGGER_DEBUG);
|
||||
Core\Logger::log('Path "' . $directory . '" is not a directory for user ' . self::getSystemUser(), Core\Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($check_writable && !is_writable($directory)) {
|
||||
logger('Path "' . $directory . '" is not writable for user ' . self::getSystemUser(), LOGGER_DEBUG);
|
||||
Core\Logger::log('Path "' . $directory . '" is not writable for user ' . self::getSystemUser(), Core\Logger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1645,7 +1518,7 @@ class App
|
|||
} else {
|
||||
// Someone came with an invalid parameter, maybe as a DDoS attempt
|
||||
// We simply stop processing here
|
||||
logger("Invalid ZRL parameter " . $_GET['zrl'], LOGGER_DEBUG);
|
||||
Core\Logger::log("Invalid ZRL parameter " . $_GET['zrl'], Core\Logger::DEBUG);
|
||||
Core\System::httpExit(403, ['title' => '403 Forbidden']);
|
||||
}
|
||||
}
|
||||
|
@ -1681,7 +1554,7 @@ class App
|
|||
$this->module = 'maintenance';
|
||||
} else {
|
||||
$this->checkURL();
|
||||
check_db(false);
|
||||
Core\Update::check(false);
|
||||
Core\Addon::loadAddons();
|
||||
Core\Hook::loadHooks();
|
||||
}
|
||||
|
@ -1784,15 +1657,15 @@ class App
|
|||
}
|
||||
|
||||
if (!empty($_SERVER['QUERY_STRING']) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
|
||||
logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
|
||||
Core\Logger::log('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
|
||||
$this->internalRedirect($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
||||
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
|
||||
Core\Logger::log('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], Core\Logger::DEBUG);
|
||||
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . Core\L10n::t('Not Found'));
|
||||
$tpl = get_markup_template("404.tpl");
|
||||
$this->page['content'] = replace_macros($tpl, [
|
||||
$tpl = Core\Renderer::getMarkupTemplate("404.tpl");
|
||||
$this->page['content'] = Core\Renderer::replaceMacros($tpl, [
|
||||
'$message' => Core\L10n::t('Page not found.')
|
||||
]);
|
||||
}
|
||||
|
@ -1880,7 +1753,7 @@ class App
|
|||
|
||||
// Add the navigation (menu) template
|
||||
if ($this->module != 'install' && $this->module != 'maintenance') {
|
||||
$this->page['htmlhead'] .= replace_macros(get_markup_template('nav_head.tpl'), []);
|
||||
$this->page['htmlhead'] .= Core\Renderer::replaceMacros(Core\Renderer::getMarkupTemplate('nav_head.tpl'), []);
|
||||
$this->page['nav'] = Content\Nav::build($this);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica;
|
||||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
|
||||
/**
|
||||
|
@ -136,8 +137,8 @@ abstract class BaseModule extends BaseObject
|
|||
{
|
||||
if (!self::checkFormSecurityToken($typename, $formname)) {
|
||||
$a = get_app();
|
||||
logger('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
|
||||
logger('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
|
||||
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
|
||||
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
|
||||
notice(self::getFormSecurityStandardErrorMessage());
|
||||
$a->internalRedirect($err_redirect);
|
||||
}
|
||||
|
@ -147,8 +148,8 @@ abstract class BaseModule extends BaseObject
|
|||
{
|
||||
if (!self::checkFormSecurityToken($typename, $formname)) {
|
||||
$a = get_app();
|
||||
logger('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
|
||||
logger('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA);
|
||||
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
|
||||
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class BaseObject
|
|||
/**
|
||||
* Set the app
|
||||
*
|
||||
* @param object $app App
|
||||
* @param App $app App
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace Friendica\Content;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -122,9 +123,9 @@ class ForumManager
|
|||
$entries[] = $entry;
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('widget_forumlist.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('widget_forumlist.tpl');
|
||||
|
||||
$o .= replace_macros(
|
||||
$o .= Renderer::replaceMacros(
|
||||
$tpl,
|
||||
[
|
||||
'$title' => L10n::t('Forums'),
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -61,9 +62,9 @@ class Nav
|
|||
|
||||
$nav_info = self::getInfo($a);
|
||||
|
||||
$tpl = get_markup_template('nav.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('nav.tpl');
|
||||
|
||||
$nav .= replace_macros($tpl, [
|
||||
$nav .= Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$sitelocation' => $nav_info['sitelocation'],
|
||||
'$nav' => $nav_info['nav'],
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -178,8 +179,8 @@ class OEmbed
|
|||
|
||||
$th = 120;
|
||||
$tw = $th * $tr;
|
||||
$tpl = get_markup_template('oembed_video.tpl');
|
||||
$ret .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('oembed_video.tpl');
|
||||
$ret .= Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => System::baseUrl(),
|
||||
'$embedurl' => $oembed->embed_url,
|
||||
'$escapedhtml' => base64_encode($oembed->html),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Content;
|
||||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
/**
|
||||
* The Pager has two very different output, Minimal and Full, see renderMinimal() and renderFull() for more details.
|
||||
|
@ -172,8 +173,8 @@ class Pager
|
|||
]
|
||||
];
|
||||
|
||||
$tpl = get_markup_template('paginate.tpl');
|
||||
return replace_macros($tpl, ['pager' => $data]);
|
||||
$tpl = Renderer::getMarkupTemplate('paginate.tpl');
|
||||
return Renderer::replaceMacros($tpl, ['pager' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,7 +277,7 @@ class Pager
|
|||
];
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('paginate.tpl');
|
||||
return replace_macros($tpl, ['pager' => $data]);
|
||||
$tpl = Renderer::getMarkupTemplate('paginate.tpl');
|
||||
return Renderer::replaceMacros($tpl, ['pager' => $data]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Event;
|
||||
|
@ -379,7 +381,7 @@ class BBCode extends BaseObject
|
|||
$c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism', $s, $matches, PREG_SET_ORDER);
|
||||
if ($c) {
|
||||
foreach ($matches as $mtch) {
|
||||
logger('scale_external_image: ' . $mtch[1]);
|
||||
Logger::log('scale_external_image: ' . $mtch[1]);
|
||||
|
||||
$hostname = str_replace('www.', '', substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3));
|
||||
if (stristr($mtch[1], $hostname)) {
|
||||
|
@ -414,7 +416,7 @@ class BBCode extends BaseObject
|
|||
$Image->scaleDown(640);
|
||||
$new_width = $Image->getWidth();
|
||||
$new_height = $Image->getHeight();
|
||||
logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
|
||||
Logger::log('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], Logger::DEBUG);
|
||||
$s = str_replace(
|
||||
$mtch[0],
|
||||
'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
|
||||
|
@ -423,7 +425,7 @@ class BBCode extends BaseObject
|
|||
: ''),
|
||||
$s
|
||||
);
|
||||
logger('scale_external_images: new string: ' . $s, LOGGER_DEBUG);
|
||||
Logger::log('scale_external_images: new string: ' . $s, Logger::DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +453,7 @@ class BBCode extends BaseObject
|
|||
// than the maximum, then don't waste time looking for the images
|
||||
if ($maxlen && (strlen($body) > $maxlen)) {
|
||||
|
||||
logger('the total body length exceeds the limit', LOGGER_DEBUG);
|
||||
Logger::log('the total body length exceeds the limit', Logger::DEBUG);
|
||||
|
||||
$orig_body = $body;
|
||||
$new_body = '';
|
||||
|
@ -471,7 +473,7 @@ class BBCode extends BaseObject
|
|||
|
||||
if (($textlen + $img_start) > $maxlen) {
|
||||
if ($textlen < $maxlen) {
|
||||
logger('the limit happens before an embedded image', LOGGER_DEBUG);
|
||||
Logger::log('the limit happens before an embedded image', Logger::DEBUG);
|
||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||
$textlen = $maxlen;
|
||||
}
|
||||
|
@ -485,7 +487,7 @@ class BBCode extends BaseObject
|
|||
|
||||
if (($textlen + $img_end) > $maxlen) {
|
||||
if ($textlen < $maxlen) {
|
||||
logger('the limit happens before the end of a non-embedded image', LOGGER_DEBUG);
|
||||
Logger::log('the limit happens before the end of a non-embedded image', Logger::DEBUG);
|
||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||
$textlen = $maxlen;
|
||||
}
|
||||
|
@ -508,11 +510,11 @@ class BBCode extends BaseObject
|
|||
|
||||
if (($textlen + strlen($orig_body)) > $maxlen) {
|
||||
if ($textlen < $maxlen) {
|
||||
logger('the limit happens after the end of the last image', LOGGER_DEBUG);
|
||||
Logger::log('the limit happens after the end of the last image', Logger::DEBUG);
|
||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||
}
|
||||
} else {
|
||||
logger('the text size with embedded images extracted did not violate the limit', LOGGER_DEBUG);
|
||||
Logger::log('the text size with embedded images extracted did not violate the limit', Logger::DEBUG);
|
||||
$new_body = $new_body . $orig_body;
|
||||
}
|
||||
|
||||
|
@ -985,8 +987,8 @@ class BBCode extends BaseObject
|
|||
} else {
|
||||
$text = ($is_quote_share? "\n" : '');
|
||||
|
||||
$tpl = get_markup_template('shared_content.tpl');
|
||||
$text .= replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('shared_content.tpl');
|
||||
$text .= Renderer::replaceMacros($tpl, [
|
||||
'$profile' => $attributes['profile'],
|
||||
'$avatar' => $attributes['avatar'],
|
||||
'$author' => $attributes['author'],
|
||||
|
|
|
@ -11,9 +11,11 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
|
@ -29,7 +31,7 @@ class Widget
|
|||
*/
|
||||
public static function follow($value = "")
|
||||
{
|
||||
return replace_macros(get_markup_template('follow.tpl'), array(
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('follow.tpl'), array(
|
||||
'$connect' => L10n::t('Add New Contact'),
|
||||
'$desc' => L10n::t('Enter address or web location'),
|
||||
'$hint' => L10n::t('Example: bob@example.com, http://example.com/barbara'),
|
||||
|
@ -72,7 +74,7 @@ class Widget
|
|||
$aside = [];
|
||||
$aside['$nv'] = $nv;
|
||||
|
||||
return replace_macros(get_markup_template('peoplefind.tpl'), $aside);
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('peoplefind.tpl'), $aside);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,7 +152,7 @@ class Widget
|
|||
return '';
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('nets.tpl'), array(
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('nets.tpl'), array(
|
||||
'$title' => L10n::t('Networks'),
|
||||
'$desc' => '',
|
||||
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
||||
|
@ -185,13 +187,14 @@ class Widget
|
|||
$terms = array();
|
||||
$cnt = preg_match_all('/\[(.*?)\]/', $saved, $matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$unescaped = xmlify(file_tag_decode($mtch[1]));
|
||||
foreach ($matches as $mtch)
|
||||
{
|
||||
$unescaped = xmlify(FileTag::decode($mtch[1]));
|
||||
$terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
||||
}
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('fileas_widget.tpl'), array(
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('fileas_widget.tpl'), array(
|
||||
'$title' => L10n::t('Saved Folders'),
|
||||
'$desc' => '',
|
||||
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
||||
|
@ -226,12 +229,12 @@ class Widget
|
|||
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$unescaped = xmlify(file_tag_decode($mtch[1]));
|
||||
$unescaped = xmlify(FileTag::decode($mtch[1]));
|
||||
$terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
||||
}
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('categories_widget.tpl'), array(
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('categories_widget.tpl'), array(
|
||||
'$title' => L10n::t('Categories'),
|
||||
'$desc' => '',
|
||||
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
||||
|
@ -298,7 +301,7 @@ class Widget
|
|||
$r = GContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true);
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('remote_friends_common.tpl'), array(
|
||||
'$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t),
|
||||
'$base' => System::baseUrl(),
|
||||
'$uid' => $profile_uid,
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace Friendica\Content\Widget;
|
|||
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/text.php';
|
||||
|
@ -60,8 +61,8 @@ class CalendarExport
|
|||
// of the profile page it should be the personal /events page. So we can use $a->user.
|
||||
$user = defaults($a->data['user'], 'nickname', $a->user['nickname']);
|
||||
|
||||
$tpl = get_markup_template("events_aside.tpl");
|
||||
$return = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate("events_aside.tpl");
|
||||
$return = Renderer::replaceMacros($tpl, [
|
||||
'$etitle' => L10n::t("Export"),
|
||||
'$export_ical' => L10n::t("Export calendar as ical"),
|
||||
'$export_csv' => L10n::t("Export calendar as csv"),
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
namespace Friendica\Content\Widget;
|
||||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -49,8 +50,8 @@ class TagCloud
|
|||
$tags[] = $tag;
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('tagblock_widget.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('tagblock_widget.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$title' => L10n::t('Tags'),
|
||||
'$tags' => $tags
|
||||
]);
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Friendica\Core;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
@ -291,8 +292,8 @@ class ACL extends BaseObject
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('acl_selector.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
$tpl = Renderer::getMarkupTemplate('acl_selector.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$showall' => L10n::t('Visible to everybody'),
|
||||
'$show' => L10n::t('show'),
|
||||
'$hide' => L10n::t('don\'t show'),
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
/**
|
||||
|
@ -75,7 +76,7 @@ class Addon extends BaseObject
|
|||
*/
|
||||
public static function uninstall($addon)
|
||||
{
|
||||
logger("Addons: uninstalling " . $addon);
|
||||
Logger::log("Addons: uninstalling " . $addon);
|
||||
DBA::delete('addon', ['name' => $addon]);
|
||||
|
||||
@include_once('addon/' . $addon . '/' . $addon . '.php');
|
||||
|
@ -100,7 +101,7 @@ class Addon extends BaseObject
|
|||
if (!file_exists('addon/' . $addon . '/' . $addon . '.php')) {
|
||||
return false;
|
||||
}
|
||||
logger("Addons: installing " . $addon);
|
||||
Logger::log("Addons: installing " . $addon);
|
||||
$t = @filemtime('addon/' . $addon . '/' . $addon . '.php');
|
||||
@include_once('addon/' . $addon . '/' . $addon . '.php');
|
||||
if (function_exists($addon . '_install')) {
|
||||
|
@ -125,7 +126,7 @@ class Addon extends BaseObject
|
|||
}
|
||||
return true;
|
||||
} else {
|
||||
logger("Addons: FAILED installing " . $addon);
|
||||
Logger::log("Addons: FAILED installing " . $addon);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +156,7 @@ class Addon extends BaseObject
|
|||
$t = @filemtime($fname);
|
||||
foreach ($installed as $i) {
|
||||
if (($i['name'] == $addon) && ($i['timestamp'] != $t)) {
|
||||
logger('Reloading addon: ' . $i['name']);
|
||||
Logger::log('Reloading addon: ' . $i['name']);
|
||||
@include_once($fname);
|
||||
|
||||
if (function_exists($addon . '_uninstall')) {
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -153,10 +154,10 @@ class Authentication extends BaseObject
|
|||
}
|
||||
|
||||
if ($login_initial) {
|
||||
logger('auth_identities: ' . print_r($a->identities, true), LOGGER_DEBUG);
|
||||
Logger::log('auth_identities: ' . print_r($a->identities, true), Logger::DEBUG);
|
||||
}
|
||||
if ($login_refresh) {
|
||||
logger('auth_identities refresh: ' . print_r($a->identities, true), LOGGER_DEBUG);
|
||||
Logger::log('auth_identities refresh: ' . print_r($a->identities, true), Logger::DEBUG);
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => true]);
|
||||
|
@ -184,7 +185,7 @@ class Authentication extends BaseObject
|
|||
* The week ensures that sessions will expire after some inactivity.
|
||||
*/
|
||||
if (!empty($_SESSION['remember'])) {
|
||||
logger('Injecting cookie for remembered user ' . $a->user['nickname']);
|
||||
Logger::log('Injecting cookie for remembered user ' . $a->user['nickname']);
|
||||
self::setCookie(604800, $user_record);
|
||||
unset($_SESSION['remember']);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue