]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
Fix unused code in include
[friendica.git] / mod / admin.php
index af6150460e2ef4da08eb56f3679b1d0ed07f792f..d8e2226a795470dea2a55805bb16bc1fb89d52a3 100644 (file)
@@ -10,8 +10,10 @@ use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
+use Friendica\Database\DBStructure;
 use Friendica\Model\Contact;
 use Friendica\Model\User;
+use Friendica\Module\Login;
 
 require_once 'include/enotify.php';
 require_once 'include/text.php';
@@ -152,7 +154,7 @@ function admin_post(App $a)
 function admin_content(App $a)
 {
        if (!is_site_admin()) {
-               return login(false);
+               return Login::form();
        }
 
        if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
@@ -533,7 +535,7 @@ function admin_page_federation(App $a)
        // off one % two of them are needed in the query
        // Add more platforms if you like, when one returns 0 known nodes it is not
        // displayed on the stats page.
-       $platforms = array('Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon', 'Pleroma');
+       $platforms = array('Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon', 'Pleroma', 'socialhome');
        $colors = array(
                'Friendi%%a' => '#ffc018', // orange from the logo
                'Diaspora'   => '#a1a1a1', // logo is black and white, makes a gray
@@ -543,19 +545,22 @@ function admin_page_federation(App $a)
                'GNU Social' => '#a22430', // dark red from the logo
                'StatusNet'  => '#789240', // the green from the logo (red and blue have already others
                'Mastodon'   => '#1a9df9', // blue from the Mastodon logo
-               'Pleroma'    => '#E46F0F'  // Orange from the text that is used on Pleroma instances
+               'Pleroma'    => '#E46F0F', // Orange from the text that is used on Pleroma instances
+               'socialhome' => '#52056b'  // lilac from the Django Image used at the Socialhome homepage
        );
        $counts = array();
        $total = 0;
+       $users = 0;
 
        foreach ($platforms as $p) {
                // get a total count for the platform, the name and version of the
                // highest version and the protocol tpe
-               $c = q('SELECT COUNT(*) AS `total`, ANY_VALUE(`platform`) AS `platform`,
+               $c = q('SELECT COUNT(*) AS `total`, SUM(`registered-users`) AS `users`, ANY_VALUE(`platform`) AS `platform`,
                                ANY_VALUE(`network`) AS `network`, MAX(`version`) AS `version` FROM `gserver`
                                WHERE `platform` LIKE "%s" AND `last_contact` >= `last_failure`
                                ORDER BY `version` ASC;', $p);
-               $total = $total + $c[0]['total'];
+               $total += $c[0]['total'];
+               $users += $c[0]['users'];
 
                // what versions for that platform do we know at all?
                // again only the active nodes
@@ -647,7 +652,7 @@ function admin_page_federation(App $a)
                '$autoactive' => Config::get('system', 'poco_completion'),
                '$counts' => $counts,
                '$version' => FRIENDICA_VERSION,
-               '$legendtext' => sprintf(t('Currently this node is aware of %d nodes from the following platforms:'), $total),
+               '$legendtext' => sprintf(t('Currently this node is aware of %d nodes with %d registered users from the following platforms:'), $total, $users),
                '$baseurl' => System::baseUrl(),
        ));
 }
@@ -708,7 +713,7 @@ function admin_page_summary(App $a)
        $warningtext = array();
        if (DBM::is_result($r)) {
                $showwarning = true;
-               $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php include/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
+               $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php scripts/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
        }
        // Check if github.com/friendica/master/VERSION is higher then
        // the local version of Friendica. Check is opt-in, source may be master or devel branch
@@ -721,12 +726,11 @@ function admin_page_summary(App $a)
        }
 
        if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) {
-               require_once("include/dbstructure.php");
-               update_structure(false, true);
+               DBStructure::update(false, true);
        }
        if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
                $showwarning = true;
-               $warningtext[] = t('The database update failed. Please run "php include/dbstructure.php update" from the command line and have a look at the errors that might appear.');
+               $warningtext[] = t('The database update failed. Please run "php scripts/dbstructure.php update" from the command line and have a look at the errors that might appear.');
        }
 
        $last_worker_call = Config::get('system', 'last_poller_execution', false);
@@ -1173,7 +1177,8 @@ function admin_page_site(App $a)
        $community_page_style_choices = array(
                CP_NO_COMMUNITY_PAGE => t("No community page"),
                CP_USERS_ON_SERVER => t("Public postings from users of this site"),
-               CP_GLOBAL_COMMUNITY => t("Global community page")
+               CP_GLOBAL_COMMUNITY => t("Public postings from the federated network"),
+               CP_USERS_AND_GLOBAL => t("Public postings from local users and the federated network")
        );
 
        /* OStatus conversation poll choices */
@@ -1308,7 +1313,7 @@ function admin_page_site(App $a)
                '$no_multi_reg'         => array('no_multi_reg', t("Block multiple registrations"),  Config::get('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
                '$no_openid'            => array('no_openid', t("OpenID support"), !Config::get('system','no_openid'), t("OpenID support for registration and logins.")),
                '$no_regfullname'       => array('no_regfullname', t("Fullname check"), !Config::get('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")),
-               '$community_page_style' => array('community_page_style', t("Community Page Style"), Config::get('system','community_page_style'), t("Type of community page to show. 'Global community' shows every public posting from an open distributed network that arrived on this server."), $community_page_style_choices),
+               '$community_page_style' => array('community_page_style', t("Community pages for visitors"), Config::get('system','community_page_style'), t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices),
                '$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")),
                '$ostatus_disabled'     => array('ostatus_disabled', t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")),
                '$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")),
@@ -1385,8 +1390,7 @@ function admin_page_dbsync(App $a)
        }
 
        if (($a->argc > 2) && (intval($a->argv[2]) || ($a->argv[2] === 'check'))) {
-               require_once("include/dbstructure.php");
-               $retval = update_structure(false, true);
+               $retval = DBStructure::update(false, true);
                if (!$retval) {
                        $o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION) . "<br />";
                        Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');