code style & install-403 fix

This commit is contained in:
Philipp Holzer 2019-04-14 14:05:48 +02:00
parent d579d9e1d0
commit 58c9566c3d
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
6 changed files with 138 additions and 133 deletions

View file

@ -40,7 +40,7 @@ Options
-P|--dbpass <password> The password of the mysql/mariadb database login (env MYSQL_PASSWORD)
-U|--url <url> The full base URL of Friendica - f.e. 'https://friendica.local/sub' (env FRIENDICA_URL)
-B|--phppath <php_path> The path of the PHP binary (env FRIENDICA_PHP_PATH)
-b|--basepath <base_path> The basepath of Friendica(env FRIENDICA_BASE_PATH)
-b|--basepath <base_path> The basepath of Friendica (env FRIENDICA_BASE_PATH)
-t|--tz <timezone> The timezone of Friendica (env FRIENDICA_TZ)
-L|--lang <language> The language of Friendica (env FRIENDICA_LANG)

View file

@ -249,8 +249,9 @@ class Installer
$help .= L10n::t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See <a href='https://github.com/friendica/friendica/blob/master/doc/Install.md#set-up-the-worker'>'Setup the worker'</a>") . EOL;
$help .= EOL . EOL;
$tpl = Renderer::getMarkupTemplate('field_input.tpl');
/// @todo Separate backend Installer class and presentation layer/view
$help .= Renderer::replaceMacros($tpl, [
'$field' => ['config.php_path', L10n::t('PHP executable path'), $phppath, L10n::t('Enter full path to php executable. You can leave this blank to continue the installation.')],
'$field' => ['config-php_path', L10n::t('PHP executable path'), $phppath, L10n::t('Enter full path to php executable. You can leave this blank to continue the installation.')],
]);
$phppath = "";
}

View file

@ -15,17 +15,17 @@ use Friendica\Render\ITemplateEngine;
*/
class Renderer extends BaseObject
{
/**
/**
* @brief An array of registered template engines ('name'=>'class name')
*/
public static $template_engines = [];
public static $template_engines = [];
/**
/**
* @brief An array of instanced template engines ('name'=>'instance')
*/
public static $template_engine_instance = [];
/**
/**
* @brief An array for all theme-controllable parameters
*
* Mostly unimplemented yet. Only options 'template_engine' and
@ -39,15 +39,15 @@ class Renderer extends BaseObject
'stylesheet' => '',
'template_engine' => 'smarty3',
];
private static $ldelim = [
private static $ldelim = [
'internal' => '',
'smarty3' => '{{'
];
private static $rdelim = [
'internal' => '',
'smarty3' => '}}'
];
];
/**
* @brief This is our template processor
@ -59,28 +59,28 @@ class Renderer extends BaseObject
* @return string substituted string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function replaceMacros($s, $vars, $overwriteURL = true)
{
$stamp1 = microtime(true);
$a = self::getApp();
public static function replaceMacros($s, $vars, $overwriteURL = true)
{
$stamp1 = microtime(true);
$a = self::getApp();
// pass $baseurl to all templates
// pass $baseurl to all templates
if ($overwriteURL) {
$vars['$baseurl'] = System::baseUrl();
}
$t = self::getTemplateEngine();
$t = self::getTemplateEngine();
try {
$output = $t->replaceMacros($s, $vars);
} catch (Exception $e) {
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
exit();
}
try {
$output = $t->replaceMacros($s, $vars);
} catch (Exception $e) {
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
exit();
}
$a->getProfiler()->saveTimestamp($stamp1, "rendering", System::callstack());
return $output;
}
return $output;
}
/**
* @brief Load a given template $s
@ -91,35 +91,35 @@ class Renderer extends BaseObject
* @return string template.
* @throws Exception
*/
public static function getMarkupTemplate($s, $root = '')
{
$stamp1 = microtime(true);
$a = self::getApp();
$t = self::getTemplateEngine();
public static function getMarkupTemplate($s, $root = '')
{
$stamp1 = microtime(true);
$a = self::getApp();
$t = self::getTemplateEngine();
try {
$template = $t->getTemplateFile($s, $root);
} catch (Exception $e) {
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
exit();
}
try {
$template = $t->getTemplateFile($s, $root);
} catch (Exception $e) {
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
exit();
}
$a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
$a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
return $template;
}
return $template;
}
/**
/**
* @brief Register template engine class
*
* @param string $class
*/
public static function registerTemplateEngine($class)
{
$v = get_class_vars($class);
if (!empty($v['name']))
{
$v = get_class_vars($class);
if (!empty($v['name']))
{
$name = $v['name'];
self::$template_engines[$name] = $class;
} else {
@ -153,9 +153,9 @@ class Renderer extends BaseObject
echo "template engine <tt>$template_engine</tt> is not registered!\n";
exit();
}
/**
}
/**
* @brief Returns the active template engine.
*
* @return string the active template engine
@ -175,7 +175,7 @@ class Renderer extends BaseObject
self::$theme['template_engine'] = $engine;
}
/**
/**
* Gets the right delimiter for a template engine
*
* Currently: