return;
}
- // urls
+ $return_path = 'admin';
if ($a->argc > 1) {
switch ($a->argv[1]) {
case 'site':
$func($a);
}
}
- goaway('admin/plugins/' . $a->argv[2]);
- return; // NOTREACHED
+ $return_path = 'admin/plugins/' . $a->argv[2];
break;
case 'themes':
if ($a->argc < 2) {
$theme = $a->argv[2];
if (is_file("view/theme/$theme/config.php")) {
-
- function __call_theme_admin_post(App $a, $theme)
- {
- $orig_theme = $a->theme;
- $orig_page = $a->page;
- $orig_session_theme = $_SESSION['theme'];
- require_once("view/theme/$theme/theme.php");
- require_once("view/theme/$theme/config.php");
- $_SESSION['theme'] = $theme;
-
-
- $init = $theme . "_init";
- if (function_exists($init)) {
- $init($a);
- }
- if (function_exists("theme_admin_post")) {
- $admin_form = theme_admin_post($a);
- }
-
- $_SESSION['theme'] = $orig_session_theme;
- $a->theme = $orig_theme;
- $a->page = $orig_page;
- return $admin_form;
+ $orig_theme = $a->theme;
+ $orig_page = $a->page;
+ $orig_session_theme = $_SESSION['theme'];
+ require_once "view/theme/$theme/theme.php";
+ require_once "view/theme/$theme/config.php";
+ $_SESSION['theme'] = $theme;
+
+ $init = $theme . '_init';
+ if (function_exists($init)) {
+ $init($a);
}
- __call_theme_admin_post($a, $theme);
+ if (function_exists('theme_admin_post')) {
+ theme_admin_post($a);
+ }
+
+ $_SESSION['theme'] = $orig_session_theme;
+ $a->theme = $orig_theme;
+ $a->page = $orig_page;
}
+
info(t('Theme settings updated.'));
if (is_ajax()) {
return;
}
- goaway('admin/themes/' . $theme);
- return;
+ $return_path = 'admin/themes/' . $theme;
break;
case 'features':
admin_page_features_post($a);
case 'logs':
admin_page_logs_post($a);
break;
- case 'dbsync':
- admin_page_dbsync_post($a);
- break;
case 'contactblock':
admin_page_contactblock_post($a);
break;
}
}
- goaway('admin');
+ goaway($return_path);
return; // NOTREACHED
}
if (Config::get('system', 'check_new_version_url', 'none') != 'none') {
$gitversion = Config::get('system', 'git_friendica_version');
if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) {
- $warningtext[] = sprintf(t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s'), $FRIENDICA_VERSION, $gitversion);
+ $warningtext[] = sprintf(t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s'), FRIENDICA_VERSION, $gitversion);
$showwarning = true;
}
}
$new_url = rtrim($new_url, "/");
$parsed = @parse_url($new_url);
- if (!$parsed || (!x($parsed, 'host') || !x($parsed, 'scheme'))) {
+ if (!is_array($parsed) || !x($parsed, 'host') || !x($parsed, 'scheme')) {
notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
goaway('admin/site');
}
$theme_choices_mobile = array();
$theme_choices_mobile["---"] = t("No special theme for mobile devices");
$files = glob('view/theme/*');
- if ($files) {
-
+ if (is_array($files)) {
$allowed_theme_list = Config::get('system', 'allowed_themes');
foreach ($files as $file) {
CP_USERS_AND_GLOBAL => t("Public postings from local users and the federated network")
);
- /* OStatus conversation poll choices */
- $ostatus_poll_choices = array(
- "-2" => t("Never"),
- "-1" => t("At post arrival"),
- "0" => t("Frequently"),
- "60" => t("Hourly"),
- "720" => t("Twice daily"),
- "1440" => t("Daily")
- );
-
$poco_discovery_choices = array(
"0" => t("Disabled"),
"1" => t("Users"),
if (($a->argc > 2) && (intval($a->argv[2]) || ($a->argv[2] === 'check'))) {
$retval = DBStructure::update(false, true);
- if (!$retval) {
+ if ($retval === '') {
$o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION) . "<br />";
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
} else {
if (in_array($new_order, $valid_orders)) {
$order = $new_order;
}
- if (x($_GET, 'd')) {
- $new_direction = $_GET['d'];
- }
}
$sql_order = "`" . str_replace('.', '`.`', $order) . "`";
$sql_order_direction = ($order_direction === "+") ? "ASC" : "DESC";
}
// display plugin details
- require_once('library/markdown.php');
-
if (in_array($plugin, $a->plugins)) {
$status = "on";
$action = t("Disable");
$readme = Null;
if (is_file("addon/$plugin/README.md")) {
+ require_once 'library/markdown.php';
$readme = file_get_contents("addon/$plugin/README.md");
$readme = Markdown($readme, false);
} elseif (is_file("addon/$plugin/README")) {
}
$admin_form = "";
- if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)) {
+ if (in_array($plugin, $a->plugins_admin)) {
@require_once("addon/$plugin/$plugin.php");
$func = $plugin . '_plugin_admin';
$func($a, $admin_form);
$plugins = array();
$files = glob("addon/*/");
- if ($files) {
+ if (is_array($files)) {
foreach ($files as $file) {
if (is_dir($file)) {
list($tmp, $id) = array_map("trim", explode("/", $file));
*/
function toggle_theme(&$themes, $th, &$result)
{
- for ($x = 0; $x < count($themes); $x ++) {
+ $count = count($themes);
+ for ($x = 0; $x < $count; $x ++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
$themes[$x]['allowed'] = 0;
*/
function theme_status($themes, $th)
{
- for ($x = 0; $x < count($themes); $x ++) {
+ $count = count($themes);
+ for ($x = 0; $x < $count; $x ++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
return 1;
$themes = array();
$files = glob('view/theme/*');
- if ($files) {
+ if (is_array($files)) {
foreach ($files as $file) {
$f = basename($file);
}
// display theme details
- require_once 'library/markdown.php';
-
if (theme_status($themes, $theme)) {
$status = "on";
$action = t("Disable");
$action = t("Enable");
}
- $readme = Null;
+ $readme = null;
if (is_file("view/theme/$theme/README.md")) {
+ require_once 'library/markdown.php';
$readme = file_get_contents("view/theme/$theme/README.md");
$readme = Markdown($readme, false);
} elseif (is_file("view/theme/$theme/README")) {
$readme = "<pre>" . file_get_contents("view/theme/$theme/README") . "</pre>";
}
- $admin_form = "";
+ $admin_form = '';
if (is_file("view/theme/$theme/config.php")) {
+ $orig_theme = $a->theme;
+ $orig_page = $a->page;
+ $orig_session_theme = $_SESSION['theme'];
+ require_once "view/theme/$theme/theme.php";
+ require_once "view/theme/$theme/config.php";
+ $_SESSION['theme'] = $theme;
+
+ $init = $theme . "_init";
+ if (function_exists($init)) {
+ $init($a);
+ }
- function __get_theme_admin_form(App $a, $theme)
- {
- $orig_theme = $a->theme;
- $orig_page = $a->page;
- $orig_session_theme = $_SESSION['theme'];
- require_once("view/theme/$theme/theme.php");
- require_once("view/theme/$theme/config.php");
- $_SESSION['theme'] = $theme;
-
-
- $init = $theme . "_init";
- if (function_exists($init)) {
- $init($a);
- }
- if (function_exists("theme_admin")) {
- $admin_form = theme_admin($a);
- }
-
- $_SESSION['theme'] = $orig_session_theme;
- $a->theme = $orig_theme;
- $a->page = $orig_page;
- return $admin_form;
+ if (function_exists('theme_admin')) {
+ $admin_form = theme_admin($a);
}
- $admin_form = __get_theme_admin_form($a, $theme);
+
+ $_SESSION['theme'] = $orig_session_theme;
+ $a->theme = $orig_theme;
+ $a->page = $orig_page;
}
$screenshot = array(get_theme_screenshot($theme), t('Screenshot'));
// reload active themes
if (x($_GET, "a") && $_GET['a'] == "r") {
check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/themes', 'admin_themes', 't');
- if ($themes) {
- foreach ($themes as $th) {
- if ($th['allowed']) {
- uninstall_theme($th['name']);
- install_theme($th['name']);
- }
+ foreach ($themes as $th) {
+ if ($th['allowed']) {
+ uninstall_theme($th['name']);
+ install_theme($th['name']);
}
}
info("Themes reloaded");
* List themes
*/
- $xthemes = array();
- if ($themes) {
- foreach ($themes as $th) {
- $xthemes[] = array($th['name'], (($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
- }
+ $plugins = array();
+ foreach ($themes as $th) {
+ $plugins[] = array($th['name'], (($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
}
$t = get_markup_template('admin/plugins.tpl');
'$reload' => t('Reload active themes'),
'$baseurl' => System::baseUrl(true),
'$function' => 'themes',
- '$plugins' => $xthemes,
+ '$plugins' => $plugins,
'$pcount' => count($themes),
'$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'),
'$experimental' => t('[Experimental]'),
logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
- $arr = array();
$features = Feature::get(false);
foreach ($features as $fname => $fdata) {
foreach (array_slice($fdata, 1) as $f) {
- $feature = $f[0];
+ $f eature = $f[0];
$feature_state = 'feature_' . $feature;
$featurelock = 'featurelock_' . $feature;
}
$tpl = get_markup_template('admin/settings_features.tpl');
- $o .= replace_macros($tpl, array(
+ $o = replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("admin_manage_features"),
'$title' => t('Manage Additional Features'),
'$features' => $arr,