mirror of
https://github.com/friendica/friendica
synced 2025-04-28 01:10:12 +00:00
Merge branch '2018.12-rc' into task/move-config-to-php-array
This commit is contained in:
commit
fabc90e9dd
420 changed files with 3127 additions and 2911 deletions
|
@ -106,7 +106,7 @@ class Authentication extends BaseObject
|
|||
|
||||
$masterUid = $user_record['uid'];
|
||||
|
||||
if ((x($_SESSION, 'submanage')) && intval($_SESSION['submanage'])) {
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
$user = DBA::selectFirst('user', ['uid'], ['uid' => $_SESSION['submanage']]);
|
||||
if (DBA::isResult($user)) {
|
||||
$masterUid = $user['uid'];
|
||||
|
|
|
@ -119,11 +119,11 @@ HELP;
|
|||
$db_data = $this->getOption(['d', 'dbdata'], ($save_db) ? getenv('MYSQL_DATABASE') : '');
|
||||
$db_user = $this->getOption(['U', 'dbuser'], ($save_db) ? getenv('MYSQL_USER') . getenv('MYSQL_USERNAME') : '');
|
||||
$db_pass = $this->getOption(['P', 'dbpass'], ($save_db) ? getenv('MYSQL_PASSWORD') : '');
|
||||
$url_path = $this->getOption(['u', 'urlpath'], (!empty('FRIENDICA_URL_PATH')) ? getenv('FRIENDICA_URL_PATH') : null);
|
||||
$php_path = $this->getOption(['b', 'phppath'], (!empty('FRIENDICA_PHP_PATH')) ? getenv('FRIENDICA_PHP_PATH') : null);
|
||||
$admin_mail = $this->getOption(['A', 'admin'], (!empty('FRIENDICA_ADMIN_MAIL')) ? getenv('FRIENDICA_ADMIN_MAIL') : '');
|
||||
$tz = $this->getOption(['T', 'tz'], (!empty('FRIENDICA_TZ')) ? getenv('FRIENDICA_TZ') : '');
|
||||
$lang = $this->getOption(['L', 'lang'], (!empty('FRIENDICA_LANG')) ? getenv('FRIENDICA_LANG') : '');
|
||||
$url_path = $this->getOption(['u', 'urlpath'], !empty('FRIENDICA_URL_PATH') ? getenv('FRIENDICA_URL_PATH') : null);
|
||||
$php_path = $this->getOption(['b', 'phppath'], !empty('FRIENDICA_PHP_PATH') ? getenv('FRIENDICA_PHP_PATH') : null);
|
||||
$admin_mail = $this->getOption(['A', 'admin'], !empty('FRIENDICA_ADMIN_MAIL') ? getenv('FRIENDICA_ADMIN_MAIL') : '');
|
||||
$tz = $this->getOption(['T', 'tz'], !empty('FRIENDICA_TZ') ? getenv('FRIENDICA_TZ') : '');
|
||||
$lang = $this->getOption(['L', 'lang'], !empty('FRIENDICA_LANG') ? getenv('FRIENDICA_LANG') : '');
|
||||
|
||||
if (empty($php_path)) {
|
||||
$php_path = $installer->getPHPPath();
|
||||
|
@ -132,7 +132,7 @@ HELP;
|
|||
$installer->createConfig(
|
||||
$php_path,
|
||||
$url_path,
|
||||
((!empty($db_port)) ? $db_host . ':' . $db_port : $db_host),
|
||||
(!empty($db_port) ? $db_host . ':' . $db_port : $db_host),
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_data,
|
||||
|
|
|
@ -440,6 +440,13 @@ class Installer
|
|||
);
|
||||
$returnVal = $returnVal ? $status : false;
|
||||
|
||||
$status = $this->checkFunction('json_encode',
|
||||
L10n::t('JSON PHP module'),
|
||||
L10n::t('Error: JSON PHP module required but not installed.'),
|
||||
true
|
||||
);
|
||||
$returnVal = $returnVal ? $status : false;
|
||||
|
||||
return $returnVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -643,7 +643,7 @@ class NotificationsManager extends BaseObject
|
|||
'madeby_zrl' => Contact::magicLink($it['url']),
|
||||
'madeby_addr' => $it['addr'],
|
||||
'contact_id' => $it['contact-id'],
|
||||
'photo' => ((x($it, 'fphoto')) ? ProxyUtils::proxifyUrl($it['fphoto'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"),
|
||||
'photo' => (!empty($it['fphoto']) ? ProxyUtils::proxifyUrl($it['fphoto'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"),
|
||||
'name' => $it['fname'],
|
||||
'url' => $it['furl'],
|
||||
'zrl' => Contact::magicLink($it['furl']),
|
||||
|
@ -675,7 +675,7 @@ class NotificationsManager extends BaseObject
|
|||
'uid' => $_SESSION['uid'],
|
||||
'intro_id' => $it['intro_id'],
|
||||
'contact_id' => $it['contact-id'],
|
||||
'photo' => ((x($it, 'photo')) ? ProxyUtils::proxifyUrl($it['photo'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"),
|
||||
'photo' => (!empty($it['photo']) ? ProxyUtils::proxifyUrl($it['photo'], false, ProxyUtils::SIZE_SMALL) : "images/person-300.jpg"),
|
||||
'name' => $it['name'],
|
||||
'location' => BBCode::convert($it['glocation'], false),
|
||||
'about' => BBCode::convert($it['gabout'], false),
|
||||
|
|
|
@ -48,29 +48,29 @@ class Renderer extends BaseObject
|
|||
'internal' => '',
|
||||
'smarty3' => '}}'
|
||||
];
|
||||
|
||||
/**
|
||||
* @brief 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
|
||||
*/
|
||||
public static function replaceMacros($s, $r)
|
||||
|
||||
/**
|
||||
* @brief This is our template processor
|
||||
*
|
||||
* @param string|FriendicaSmarty $s The string requiring macro substitution or an instance of FriendicaSmarty
|
||||
* @param array $vars key value pairs (search => replace)
|
||||
*
|
||||
* @return string substituted string
|
||||
*/
|
||||
public static function replaceMacros($s, $vars)
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$a = self::getApp();
|
||||
|
||||
// pass $baseurl to all templates
|
||||
$r['$baseurl'] = System::baseUrl();
|
||||
$vars['$baseurl'] = System::baseUrl();
|
||||
$t = self::getTemplateEngine();
|
||||
|
||||
try {
|
||||
$output = $t->replaceMacros($s, $r);
|
||||
$output = $t->replaceMacros($s, $vars);
|
||||
} catch (Exception $e) {
|
||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||
killme();
|
||||
exit();
|
||||
}
|
||||
|
||||
$a->saveTimestamp($stamp1, "rendering");
|
||||
|
|
|
@ -26,7 +26,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
|
|||
|
||||
public function read($session_id)
|
||||
{
|
||||
if (!x($session_id)) {
|
||||
if (empty($session_id)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -126,9 +126,33 @@ class System extends BaseObject
|
|||
{
|
||||
$err = '';
|
||||
if ($val >= 400) {
|
||||
$err = 'Error';
|
||||
if (!isset($description["title"])) {
|
||||
$description["title"] = $err." ".$val;
|
||||
if (!empty($description['title'])) {
|
||||
$err = $description['title'];
|
||||
} else {
|
||||
$title = [
|
||||
'400' => L10n::t('Error 400 - Bad Request'),
|
||||
'401' => L10n::t('Error 401 - Unauthorized'),
|
||||
'403' => L10n::t('Error 403 - Forbidden'),
|
||||
'404' => L10n::t('Error 404 - Not Found'),
|
||||
'500' => L10n::t('Error 500 - Internal Server Error'),
|
||||
'503' => L10n::t('Error 503 - Service Unavailable'),
|
||||
];
|
||||
$err = defaults($title, $val, 'Error ' . $val);
|
||||
$description['title'] = $err;
|
||||
}
|
||||
if (empty($description['description'])) {
|
||||
// Explanations are taken from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
$explanation = [
|
||||
'400' => L10n::t('The server cannot or will not process the request due to an apparent client error.'),
|
||||
'401' => L10n::t('Authentication is required and has failed or has not yet been provided.'),
|
||||
'403' => L10n::t('The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account.'),
|
||||
'404' => L10n::t('The requested resource could not be found but may be available in the future.'),
|
||||
'500' => L10n::t('An unexpected condition was encountered and no more specific message is suitable.'),
|
||||
'503' => L10n::t('The server is currently unavailable (because it is overloaded or down for maintenance). Please try again later.'),
|
||||
];
|
||||
if (!empty($explanation[$val])) {
|
||||
$description['description'] = $explanation[$val];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +272,7 @@ class System extends BaseObject
|
|||
*/
|
||||
public static function externalRedirect($url)
|
||||
{
|
||||
if (!filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
if (empty(parse_url($url, PHP_URL_SCHEME))) {
|
||||
throw new InternalServerErrorException("'$url' is not a fully qualified URL, please use App->internalRedirect() instead");
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@ class Update
|
|||
*/
|
||||
public static function check($via_worker)
|
||||
{
|
||||
if (!DBA::connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$build = Config::get('system', 'build');
|
||||
|
||||
if (empty($build)) {
|
||||
|
@ -118,6 +122,8 @@ class Update
|
|||
Lock::release('dbupdate');
|
||||
}
|
||||
}
|
||||
} elseif ($force) {
|
||||
DBStructure::update($verbose, true);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
|
@ -105,7 +105,7 @@ class UserImport
|
|||
}
|
||||
|
||||
|
||||
if (!x($account, 'version')) {
|
||||
if (empty($account['version'])) {
|
||||
notice(L10n::t("Error! No version data in file! This is not a Friendica account file?"));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue