]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
Fix PHP cannot take a shell script
[friendica.git] / mod / admin.php
index 5d6a8fbafdd29f2b95b7426b5fb911880c8d6532..7fed765a7e548eec8595a905da9c840d15bbbea4 100644 (file)
@@ -21,6 +21,7 @@ use Friendica\Model\Item;
 use Friendica\Model\User;
 use Friendica\Module\Login;
 use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Temporal;
 
 require_once 'include/enotify.php';
 require_once 'include/text.php';
@@ -383,7 +384,7 @@ function admin_page_contactblock_post(App $a)
        check_form_security_token_redirectOnErr('/admin/contactblock', 'admin_contactblock');
 
        if (x($_POST, 'page_contactblock_block')) {
-               $contact_id = Contact::getIdForURL($contact_url, 0);
+               $contact_id = Contact::getIdForURL($contact_url);
                if ($contact_id) {
                        Contact::block($contact_id);
                        notice(L10n::t('The contact has been blocked from the node'));
@@ -504,7 +505,7 @@ function admin_page_deleteitem_post(App $a)
                // associated threads.
                $r = dba::select('item', ['id'], ['guid' => $guid]);
                while ($row = dba::fetch($r)) {
-                       Item::delete($row['id']);
+                       Item::deleteById($row['id']);
                }
                dba::close($r);
        }
@@ -538,7 +539,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 = ['Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon', 'Pleroma', 'socialhome'];
+       $platforms = ['Friendi%%a', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon', 'Pleroma', 'socialhome', 'ganggo'];
        $colors = [
                'Friendi%%a' => '#ffc018', // orange from the logo
                'Diaspora'   => '#a1a1a1', // logo is black and white, makes a gray
@@ -549,7 +550,8 @@ function admin_page_federation(App $a)
                '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
-               'socialhome' => '#52056b'  // lilac from the Django Image used at the Socialhome homepage
+               'socialhome' => '#52056b' , // lilac from the Django Image used at the Socialhome homepage
+               'ganggo'     => '#69d7e2' // from the favicon
        ];
        $counts = [];
        $total = 0;
@@ -716,7 +718,7 @@ function admin_page_summary(App $a)
        $warningtext = [];
        if (DBM::is_result($r)) {
                $showwarning = true;
-               $warningtext[] = L10n::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');
+               $warningtext[] = L10n::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 bin/console.php dbstructure 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
@@ -733,7 +735,7 @@ function admin_page_summary(App $a)
        }
        if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
                $showwarning = true;
-               $warningtext[] = L10n::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.');
+               $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.');
        }
 
        $last_worker_call = Config::get('system', 'last_poller_execution', false);
@@ -1566,7 +1568,7 @@ function admin_page_users(App $a)
        if ($a->argc > 2) {
                $uid = $a->argv[3];
                $user = dba::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
-               if (DBM::is_result($user)) {
+               if (!DBM::is_result($user)) {
                        notice('User not found' . EOL);
                        goaway('admin/users');
                        return ''; // NOTREACHED
@@ -1648,13 +1650,13 @@ function admin_page_users(App $a)
                        L10n::t('Automatic Friend Account')
                ];
                $e['page-flags'] = $accounts[$e['page-flags']];
-               $e['register_date'] = relative_date($e['register_date']);
-               $e['login_date'] = relative_date($e['login_date']);
-               $e['lastitem_date'] = relative_date($e['lastitem_date']);
+               $e['register_date'] = Temporal::getRelativeDate($e['register_date']);
+               $e['login_date'] = Temporal::getRelativeDate($e['login_date']);
+               $e['lastitem_date'] = Temporal::getRelativeDate($e['lastitem_date']);
                //$e['is_admin'] = ($e['email'] === $a->config['admin_email']);
                $e['is_admin'] = in_array($e['email'], $adminlist);
                $e['is_deletable'] = (intval($e['uid']) != local_user());
-               $e['deleted'] = ($e['account_removed'] ? relative_date($e['account_expires_on']) : False);
+               $e['deleted'] = ($e['account_removed'] ? Temporal::getRelativeDate($e['account_expires_on']) : False);
                return $e;
        };
        $users = array_map($_setup_users, $users);