]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into develop
authorAndyHee <andy@hubup.pro>
Thu, 7 Dec 2017 04:28:50 +0000 (11:28 +0700)
committerAndyHee <andy@hubup.pro>
Thu, 7 Dec 2017 04:28:50 +0000 (11:28 +0700)
135 files changed:
boot.php
database.sql
doc/htconfig.md
include/acl_selectors.php
include/api.php
include/contact_selectors.php
include/contact_widgets.php
include/conversation.php
include/crypto.php
include/dba.php
include/dbstructure.php
include/email.php [deleted file]
include/enotify.php
include/event.php
include/fcontact.php [deleted file]
include/features.php [deleted file]
include/follow.php
include/identity.php
include/items.php
include/nav.php
include/network.php
include/oauth.php [deleted file]
include/oembed.php [changed mode: 0755->0644]
include/pgettext.php
include/pidfile.php [deleted file]
include/salmon.php [deleted file]
include/tags.php
include/text.php
include/uimport.php
include/user.php [deleted file]
mod/admin.php
mod/cal.php
mod/contacts.php
mod/dfrn_request.php
mod/editpost.php
mod/hostxrd.php
mod/install.php [changed mode: 0755->0644]
mod/invite.php
mod/item.php
mod/like.php [changed mode: 0755->0644]
mod/lostpass.php
mod/network.php
mod/notice.php
mod/photos.php
mod/ping.php
mod/post.php [deleted file]
mod/profiles.php
mod/receive.php
mod/register.php
mod/regmod.php
mod/repair_ostatus.php [changed mode: 0755->0644]
mod/salmon.php
mod/search.php
mod/settings.php
mod/xrd.php
src/Content/Feature.php [new file with mode: 0644]
src/Content/ForumManager.php
src/Model/User.php
src/Network/FKOAuth1.php [new file with mode: 0644]
src/Network/FKOAuthDataStore.php [new file with mode: 0644]
src/Network/Probe.php
src/Object/Contact.php
src/Object/Item.php
src/Protocol/Diaspora.php
src/Protocol/Email.php [new file with mode: 0644]
src/Protocol/OStatus.php
src/Protocol/PortableContact.php
src/Protocol/Salmon.php [new file with mode: 0644]
src/Util/Emailer.php
src/Util/Pidfile.php [new file with mode: 0644]
src/Worker/Cron.php
src/Worker/CronJobs.php
src/Worker/DBClean.php
src/Worker/Delivery.php
src/Worker/Notifier.php
src/Worker/OnePoll.php
src/Worker/Queue.php
update.php
util/config [changed mode: 0644->0755]
util/createdoxygen.php [changed mode: 0644->0755]
util/global_community_block.php
util/vagrant_provision.sh [changed mode: 0644->0755]
util/vagrant_vhost.sh [changed mode: 0644->0755]
view/smarty3/.gitignore [changed mode: 0755->0644]
view/templates/admin/aside.tpl [new file with mode: 0644]
view/templates/admin/blocklist.tpl [new file with mode: 0644]
view/templates/admin/contactblock.tpl [new file with mode: 0644]
view/templates/admin/deleteitem.tpl [new file with mode: 0644]
view/templates/admin/federation.tpl [new file with mode: 0644]
view/templates/admin/logs.tpl [new file with mode: 0644]
view/templates/admin/plugins.tpl [new file with mode: 0644]
view/templates/admin/plugins_details.tpl [new file with mode: 0644]
view/templates/admin/queue.tpl [new file with mode: 0644]
view/templates/admin/settings_features.tpl [new file with mode: 0644]
view/templates/admin/settings_head.tpl [new file with mode: 0644]
view/templates/admin/site.tpl [new file with mode: 0644]
view/templates/admin/summary.tpl [new file with mode: 0644]
view/templates/admin/users.tpl [new file with mode: 0644]
view/templates/admin/viewlogs.tpl [new file with mode: 0644]
view/templates/admin_aside.tpl [deleted file]
view/templates/admin_blocklist.tpl [deleted file]
view/templates/admin_deleteitem.tpl [deleted file]
view/templates/admin_federation.tpl [deleted file]
view/templates/admin_logs.tpl [deleted file]
view/templates/admin_plugins.tpl [deleted file]
view/templates/admin_plugins_details.tpl [deleted file]
view/templates/admin_queue.tpl [deleted file]
view/templates/admin_settings_features.tpl [deleted file]
view/templates/admin_settings_head.tpl [deleted file]
view/templates/admin_site.tpl [deleted file]
view/templates/admin_summary.tpl [deleted file]
view/templates/admin_users.tpl [deleted file]
view/templates/admin_viewlogs.tpl [deleted file]
view/templates/auto_request.tpl
view/templates/dfrn_request.tpl
view/theme/frio/js/mod_admin.js [new file with mode: 0644]
view/theme/frio/templates/admin/aside.tpl [new file with mode: 0644]
view/theme/frio/templates/admin/contactblock.tpl [new file with mode: 0644]
view/theme/frio/templates/admin_aside.tpl [deleted file]
view/theme/frost-mobile/templates/admin/aside.tpl [new file with mode: 0644]
view/theme/frost-mobile/templates/admin/site.tpl [new file with mode: 0644]
view/theme/frost-mobile/templates/admin/users.tpl [new file with mode: 0644]
view/theme/frost-mobile/templates/admin_aside.tpl [deleted file]
view/theme/frost-mobile/templates/admin_site.tpl [deleted file]
view/theme/frost-mobile/templates/admin_users.tpl [deleted file]
view/theme/frost/templates/admin/aside.tpl [new file with mode: 0644]
view/theme/frost/templates/admin/site.tpl [new file with mode: 0644]
view/theme/frost/templates/admin/users.tpl [new file with mode: 0644]
view/theme/frost/templates/admin_aside.tpl [deleted file]
view/theme/frost/templates/admin_site.tpl [deleted file]
view/theme/frost/templates/admin_users.tpl [deleted file]
view/theme/quattro/templates/admin/users.tpl [new file with mode: 0644]
view/theme/quattro/templates/admin_users.tpl [deleted file]
view/theme/vier/plusminus.css
view/theme/vier/theme.php

index 9cdaefb2124f11942dce06d58a137d8706bb6559..c6f7b1e20d1d66dc83412978b306457f1a7d1971 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -36,7 +36,6 @@ require_once 'include/text.php';
 require_once 'include/datetime.php';
 require_once 'include/pgettext.php';
 require_once 'include/nav.php';
-require_once 'include/features.php';
 require_once 'include/identity.php';
 require_once 'update.php';
 require_once 'include/dbstructure.php';
@@ -45,7 +44,7 @@ define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'Asparagus');
 define('FRIENDICA_VERSION',      '3.6-dev');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
-define('DB_UPDATE_VERSION',      1235);
+define('DB_UPDATE_VERSION',      1236);
 
 /**
  * @brief Constant with a HTML line break.
@@ -254,25 +253,24 @@ define('PROTOCOL_SPLITTED_CONV',   6);
  * @{
  */
 define('NETWORK_DFRN',             'dfrn');    // Friendica, Mistpark, other DFRN implementations
-define('NETWORK_ZOT',              'zot!');    // Zot!
-define('NETWORK_OSTATUS',          'stat');    // status.net, identi.ca, GNU-social, other OStatus implementations
+define('NETWORK_ZOT',              'zot!');    // Zot! - Currently unsupported
+define('NETWORK_OSTATUS',          'stat');    // GNU-social, Pleroma, Mastodon, other OStatus implementations
 define('NETWORK_FEED',             'feed');    // RSS/Atom feeds with no known "post/notify" protocol
 define('NETWORK_DIASPORA',         'dspr');    // Diaspora
 define('NETWORK_MAIL',             'mail');    // IMAP/POP
-define('NETWORK_MAIL2',            'mai2');    // extended IMAP/POP
 define('NETWORK_FACEBOOK',         'face');    // Facebook API
 define('NETWORK_LINKEDIN',         'lnkd');    // LinkedIn
-define('NETWORK_XMPP',             'xmpp');    // XMPP
-define('NETWORK_MYSPACE',          'mysp');    // MySpace
+define('NETWORK_XMPP',             'xmpp');    // XMPP - Currently unsupported
+define('NETWORK_MYSPACE',          'mysp');    // MySpace - Currently unsupported
 define('NETWORK_GPLUS',            'goog');    // Google+
 define('NETWORK_PUMPIO',           'pump');    // pump.io
 define('NETWORK_TWITTER',          'twit');    // Twitter
 define('NETWORK_DIASPORA2',        'dspc');    // Diaspora connector
 define('NETWORK_STATUSNET',        'stac');    // Statusnet connector
-define('NETWORK_APPNET',           'apdn');    // app.net
-define('NETWORK_NEWS',             'nntp');    // Network News Transfer Protocol
-define('NETWORK_ICALENDAR',        'ical');    // iCalendar
-define('NETWORK_PNUT',             'pnut');    // pnut.io
+define('NETWORK_APPNET',           'apdn');    // app.net - Dead protocol
+define('NETWORK_NEWS',             'nntp');    // Network News Transfer Protocol - Currently unsupported
+define('NETWORK_ICALENDAR',        'ical');    // iCalendar - Currently unsupported
+define('NETWORK_PNUT',             'pnut');    // pnut.io - Currently unsupported
 define('NETWORK_PHANTOM',          'unkn');    // Place holder
 /**
  * @}
@@ -290,7 +288,6 @@ $netgroup_ids = array(
        NETWORK_FEED     => (-4),
        NETWORK_DIASPORA => (-5),
        NETWORK_MAIL     => (-6),
-       NETWORK_MAIL2    => (-7),
        NETWORK_FACEBOOK => (-8),
        NETWORK_LINKEDIN => (-9),
        NETWORK_XMPP     => (-10),
@@ -689,7 +686,7 @@ function update_db(App $a)
                                // Compare the current structure with the defined structure
 
                                $t = Config::get('database', 'dbupdate_' . DB_UPDATE_VERSION);
-                               if ($t !== false) {
+                               if (!is_null($t)) {
                                        return;
                                }
 
@@ -745,7 +742,7 @@ function run_update_function($x)
                // delete the config entry to try again.
 
                $t = Config::get('database', 'update_' . $x);
-               if ($t !== false) {
+               if (!is_null($t)) {
                        return false;
                }
                Config::set('database', 'update_' . $x, time());
index e4e891e482080b0b12d3349604ee6c4340d86bb2..1ff7706410f6351d061f7502f3bd52001a92c6d8 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 3.6-dev (Asparagus)
--- DB_UPDATE_VERSION 1235
+-- DB_UPDATE_VERSION 1236
 -- ------------------------------------------
 
 
@@ -216,7 +216,8 @@ CREATE TABLE IF NOT EXISTS `conversation` (
        `source` mediumtext,
        `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
         PRIMARY KEY(`item-uri`),
-        INDEX `conversation-uri` (`conversation-uri`)
+        INDEX `conversation-uri` (`conversation-uri`),
+        INDEX `received` (`received`)
 ) DEFAULT COLLATE utf8mb4_general_ci;
 
 --
@@ -273,29 +274,6 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
         UNIQUE INDEX `url` (`url`(190))
 ) DEFAULT COLLATE utf8mb4_general_ci;
 
---
--- TABLE ffinder
---
-CREATE TABLE IF NOT EXISTS `ffinder` (
-       `id` int(10) unsigned NOT NULL auto_increment,
-       `uid` int(10) unsigned NOT NULL DEFAULT 0,
-       `cid` int(10) unsigned NOT NULL DEFAULT 0,
-       `fid` int(10) unsigned NOT NULL DEFAULT 0,
-        PRIMARY KEY(`id`)
-) DEFAULT COLLATE utf8mb4_general_ci;
-
---
--- TABLE fserver
---
-CREATE TABLE IF NOT EXISTS `fserver` (
-       `id` int(11) NOT NULL auto_increment,
-       `server` varchar(255) NOT NULL DEFAULT '',
-       `posturl` varchar(255) NOT NULL DEFAULT '',
-       `key` text,
-        PRIMARY KEY(`id`),
-        INDEX `server` (`server`(32))
-) DEFAULT COLLATE utf8mb4_general_ci;
-
 --
 -- TABLE fsuggest
 --
@@ -557,22 +535,6 @@ CREATE TABLE IF NOT EXISTS `item` (
         INDEX `uid_ownerlink` (`uid`,`owner-link`(190))
 ) DEFAULT COLLATE utf8mb4_general_ci;
 
---
--- TABLE item_id
---
-CREATE TABLE IF NOT EXISTS `item_id` (
-       `id` int(11) NOT NULL auto_increment,
-       `iid` int(11) NOT NULL DEFAULT 0,
-       `uid` int(11) NOT NULL DEFAULT 0,
-       `sid` varchar(255) NOT NULL DEFAULT '',
-       `service` varchar(255) NOT NULL DEFAULT '',
-        PRIMARY KEY(`id`),
-        INDEX `uid` (`uid`),
-        INDEX `sid` (`sid`(32)),
-        INDEX `service` (`service`(32)),
-        INDEX `iid` (`iid`)
-) DEFAULT COLLATE utf8mb4_general_ci;
-
 --
 -- TABLE locks
 --
@@ -947,23 +909,6 @@ CREATE TABLE IF NOT EXISTS `sign` (
         UNIQUE INDEX `iid` (`iid`)
 ) DEFAULT COLLATE utf8mb4_general_ci;
 
---
--- TABLE spam
---
-CREATE TABLE IF NOT EXISTS `spam` (
-       `id` int(11) NOT NULL auto_increment,
-       `uid` int(11) NOT NULL DEFAULT 0,
-       `spam` int(11) NOT NULL DEFAULT 0,
-       `ham` int(11) NOT NULL DEFAULT 0,
-       `term` varchar(255) NOT NULL DEFAULT '',
-       `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
-        PRIMARY KEY(`id`),
-        INDEX `uid` (`uid`),
-        INDEX `spam` (`spam`),
-        INDEX `ham` (`ham`),
-        INDEX `term` (`term`(32))
-) DEFAULT COLLATE utf8mb4_general_ci;
-
 --
 -- TABLE term
 --
index 3f5b28b91727443dd748a82b6f70c6f7f6e84791..4d7816f49a00c758511f0fef4055e0e244aaf300 100644 (file)
@@ -46,6 +46,7 @@ Example: To set the directory value please add this line to your .htconfig.php:
 * **frontend_worker_timeout** - Value in minutes after we think that a frontend task was killed by the webserver. Default value is 10.
 * **hsts** (Boolean) - Enables the sending of HTTP Strict Transport Security headers
 * **ignore_cache** (Boolean) - For development only. Disables the item cache.
+* **instances_social_key** - Key to the API of https://instances.social which retrieves data about mastodon servers. See https://instances.social/api/token to get an API key.
 * **ipv4_resolve** (Boolean) - Resolve IPV4 addresses only. Don't resolve to IPV6. Default value is false.
 * **like_no_comment** (Boolean) - Don't update the "commented" value of an item when it is liked.
 * **local_block** (Boolean) - Used in conjunction with "block_public".
index ef75d416f6f43a45eef554f4fba06450444d7b14..f971d462b2109f9f9877adab0fe84e5e6b3e6d09 100644 (file)
@@ -1,10 +1,9 @@
 <?php
-
 /**
  * @file include/acl_selectors.php
  */
-
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Model\GlobalContact;
@@ -12,10 +11,8 @@ use Friendica\Object\Contact;
 
 require_once "include/contact_selectors.php";
 require_once "include/contact_widgets.php";
-require_once "include/features.php";
 require_once "mod/proxy.php";
 
-
 /**
  * @package acl_selectors
  */
@@ -380,7 +377,7 @@ function populate_acl($user = null, $show_jotnets = false) {
                '$aclModalTitle' => t('Permissions'),
                '$aclModalDismiss' => t('Close'),
                '$features' => array(
-               'aclautomention' => (feature_enabled($user['uid'], "aclautomention") ? "true" : "false")
+               'aclautomention' => (Feature::isEnabled($user['uid'], "aclautomention") ? "true" : "false")
                ),
        ));
 
@@ -498,10 +495,9 @@ function acl_lookup(App $a, $out_type = 'json') {
                                WHERE `uid` = %d AND NOT `self`
                                AND NOT `blocked` AND NOT `pending` AND NOT `archive`
                                AND `success_update` >= `failure_update`
-                               AND `network` IN ('%s','%s','%s') $sql_extra2" ,
+                               AND `network` IN ('%s', '%s') $sql_extra2" ,
                        intval(local_user()),
                        dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_ZOT),
                        dbesc(NETWORK_DIASPORA)
                );
                $contact_count = (int)$r[0]['c'];
@@ -593,12 +589,11 @@ function acl_lookup(App $a, $out_type = 'json') {
        } elseif ($type == 'm') {
                $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
                        WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
-                       AND `success_update` >= `failure_update` AND `network` IN ('%s','%s','%s')
+                       AND `success_update` >= `failure_update` AND `network` IN ('%s', '%s')
                        $sql_extra2
                        ORDER BY `name` ASC ",
                        intval(local_user()),
                        dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_ZOT),
                        dbesc(NETWORK_DIASPORA)
                );
        } elseif ($type == 'a') {
index 12380f4b8403e6de3a7202d752f14a43fa451b78..b5799d4786cac0e5bdb97017337e33aa120c9d51 100644 (file)
@@ -6,12 +6,14 @@
  * @todo Automatically detect if incoming data is HTML or BBCode
  */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\NotificationsManager;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
+use Friendica\Network\FKOAuth1;
 use Friendica\Network\HTTPException;
 use Friendica\Network\HTTPException\BadRequestException;
 use Friendica\Network\HTTPException\ForbiddenException;
@@ -29,7 +31,6 @@ use Friendica\Util\XML;
 require_once 'include/bbcode.php';
 require_once 'include/datetime.php';
 require_once 'include/conversation.php';
-require_once 'include/oauth.php';
 require_once 'include/html2plain.php';
 require_once 'mod/share.php';
 require_once 'mod/item.php';
@@ -156,12 +157,12 @@ function api_register_func($path, $func, $auth = false, $method = API_METHOD_ANY
  */
 function api_login(App $a)
 {
+       $oauth1 = new FKOAuth1();
        // login with oauth
        try {
-               $oauth = new FKOAuth1();
-               list($consumer,$token) = $oauth->verify_request(OAuthRequest::from_request());
+               list($consumer, $token) = $oauth1->verify_request(OAuthRequest::from_request());
                if (!is_null($token)) {
-                       $oauth->loginUser($token->uid);
+                       $oauth1->loginUser($token->uid);
                        call_hooks('logged_in', $a->user);
                        return;
                }
@@ -3363,9 +3364,9 @@ api_register_func('api/direct_messages', 'api_direct_messages_inbox', true);
 
 function api_oauth_request_token($type)
 {
+       $oauth1 = new FKOAuth1();
        try {
-               $oauth = new FKOAuth1();
-               $r = $oauth->fetch_request_token(OAuthRequest::from_request());
+               $r = $oauth1->fetch_request_token(OAuthRequest::from_request());
        } catch (Exception $e) {
                echo "error=" . OAuthUtil::urlencode_rfc3986($e->getMessage());
                killme();
@@ -3376,9 +3377,9 @@ function api_oauth_request_token($type)
 
 function api_oauth_access_token($type)
 {
+       $oauth1 = new FKOAuth1();
        try {
-               $oauth = new FKOAuth1();
-               $r = $oauth->fetch_access_token(OAuthRequest::from_request());
+               $r = $oauth1->fetch_access_token(OAuthRequest::from_request());
        } catch (Exception $e) {
                echo "error=". OAuthUtil::urlencode_rfc3986($e->getMessage());
                killme();
@@ -5100,7 +5101,7 @@ function api_friendica_profile_show($type)
        $profileid = (x($_REQUEST, 'profile_id') ? $_REQUEST['profile_id'] : 0);
 
        // retrieve general information about profiles for user
-       $multi_profiles = feature_enabled(api_user(), 'multi_profiles');
+       $multi_profiles = Feature::isEnabled(api_user(), 'multi_profiles');
        $directory = Config::get('system', 'directory');
 
        // get data of the specified profile id or all profiles of the user if not specified
index 1e754ac9f7a2655c53ca62897411de481c33c606..67d05f307bebade9f07a111ae78c3a3b21a9a674 100644 (file)
@@ -85,7 +85,6 @@ function network_to_name($s, $profile = "") {
                NETWORK_LINKEDIN => t('LinkedIn'),
                NETWORK_XMPP     => t('XMPP/IM'),
                NETWORK_MYSPACE  => t('MySpace'),
-               NETWORK_MAIL2    => t('Email'),
                NETWORK_GPLUS    => t('Google+'),
                NETWORK_PUMPIO   => t('pump.io'),
                NETWORK_TWITTER  => t('Twitter'),
index 5108eaf72390b9fec662031590ec0fba3e78e6da..31e57ea839e56f9b95bbbfd868a33089eb3a99ef 100644 (file)
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file include/contact_widgets.php
+ */
+use Friendica\Content\Feature;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
@@ -105,7 +108,7 @@ function networks_widget($baseurl, $selected = '') {
                return '';
        }
 
-       if (!feature_enabled(local_user(), 'networks')) {
+       if (!Feature::isEnabled(local_user(), 'networks')) {
                return '';
        }
 
@@ -144,7 +147,7 @@ function fileas_widget($baseurl, $selected = '') {
                return '';
        }
 
-       if (! feature_enabled(local_user(), 'filing')) {
+       if (! Feature::isEnabled(local_user(), 'filing')) {
                return '';
        }
 
@@ -178,7 +181,7 @@ function categories_widget($baseurl, $selected = '') {
 
        $a = get_app();
 
-       if (! feature_enabled($a->profile['profile_uid'], 'categories')) {
+       if (! Feature::isEnabled($a->profile['profile_uid'], 'categories')) {
                return '';
        }
 
index bba852e7ad6ffb534ee010972d72cbad0b140b06..4b9459a3f7f2efe6b90502452f5980af32adee29 100644 (file)
@@ -3,6 +3,7 @@
  * @file include/conversation.php
  */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -915,7 +916,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
                '$mode' => $mode,
                '$user' => $a->user,
                '$threads' => $threads,
-               '$dropping' => ($page_dropping && feature_enabled(local_user(), 'multi_delete') ? t('Delete Selected Items') : False),
+               '$dropping' => ($page_dropping && Feature::isEnabled(local_user(), 'multi_delete') ? t('Delete Selected Items') : False),
        ));
 
        return $o;
@@ -1305,7 +1306,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
                '$title' => $x['title'],
                '$placeholdertitle' => t('Set title'),
                '$category' => $x['category'],
-               '$placeholdercategory' => (feature_enabled(local_user(), 'categories') ? t('Categories (comma-separated list)') : ''),
+               '$placeholdercategory' => (Feature::isEnabled(local_user(), 'categories') ? t('Categories (comma-separated list)') : ''),
                '$wait' => t('Please wait'),
                '$permset' => t('Permission settings'),
                '$shortpermset' => t('permissions'),
@@ -1321,7 +1322,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) {
                '$lockstate' => $x['lockstate'],
                '$bang' => $x['bang'],
                '$profile_uid' => $x['profile_uid'],
-               '$preview' => ((feature_enabled($x['profile_uid'],'preview')) ? t('Preview') : ''),
+               '$preview' => ((Feature::isEnabled($x['profile_uid'],'preview')) ? t('Preview') : ''),
                '$jotplugins' => $jotplugins,
                '$notes_cid' => $notes_cid,
                '$sourceapp' => t($a->sourcename),
index 703439baa1615b61365ece621ee28e9d7836b4a7..dfc44c1792dfc4f056e7cc05cbe935a374a42f61 100644 (file)
@@ -91,9 +91,9 @@ function metopem($m, $e) {
        return $key;
 }
 
-function pubrsatome($key,&$m,&$e) {
-       require_once('library/asn1.php');
-       require_once('include/salmon.php');
+function pubrsatome($key, &$m, &$e)
+{
+       require_once 'library/asn1.php';
 
        $lines = explode("\n", $key);
        unset($lines[0]);
@@ -117,8 +117,8 @@ function pemtorsa($key) {
        return metorsa($m, $e);
 }
 
-function pemtome($key, &$m, &$e) {
-       require_once('include/salmon.php');
+function pemtome($key, &$m, &$e)
+{
        $lines = explode("\n", $key);
        unset($lines[0]);
        unset($lines[count($lines)]);
index 684f53ea475ff6c942237b011f2c3e74ea665133..fe191a9e21b3bf46f2043119b0d669a19b75c634 100644 (file)
@@ -1104,7 +1104,8 @@ class dba {
         *
         * $data = dba::select($table, $fields, $condition, $params);
         */
-       public static function select($table, $fields = array(), $condition = array(), $params = array()) {
+       public static function select($table, array $fields = [], array $condition = [], array $params = [])
+       {
                if ($table == '') {
                        return false;
                }
@@ -1115,17 +1116,7 @@ class dba {
                        $select_fields = "*";
                }
 
-               if (count($condition) > 0) {
-                       $array_element = each($condition);
-                       $array_key = $array_element['key'];
-                       if (is_int($array_key)) {
-                               $condition_string = " WHERE ".array_shift($condition);
-                       } else {
-                               $condition_string = " WHERE `".implode("` = ? AND `", array_keys($condition))."` = ?";
-                       }
-               } else {
-                       $condition_string = "";
-               }
+               $condition_string = self::buildCondition($condition);
 
                $param_string = '';
                $single_row = false;
@@ -1147,6 +1138,11 @@ class dba {
                        $single_row = ($params['limit'] == 1);
                }
 
+               if (isset($params['limit']) && is_array($params['limit'])) {
+                       $param_string .= " LIMIT ".intval($params['limit'][0]).", ".intval($params['limit'][1]);
+                       $single_row = ($params['limit'][1] == 1);
+               }
+
                if (isset($params['only_query']) && $params['only_query']) {
                        $single_row = !$params['only_query'];
                }
@@ -1164,6 +1160,71 @@ class dba {
                }
        }
 
+       /**
+        * @brief Counts the rows from a table satisfying the provided condition
+        *
+        * @param string $table Table name
+        * @param array $condition array of fields for condition
+        *
+        * @return int
+        *
+        * Example:
+        * $table = "item";
+        *
+        * $condition = ["uid" => 1, "network" => 'dspr'];
+        * or:
+        * $condition = ["`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr'];
+        *
+        * $count = dba::count($table, $condition);
+        */
+       public static function count($table, array $condition = [])
+       {
+               if ($table == '') {
+                       return false;
+               }
+
+               $condition_string = self::buildCondition($condition);
+
+               $sql = "SELECT COUNT(*) AS `count` FROM `".$table."`".$condition_string;
+
+               $row = self::fetch_first($sql, $condition);
+
+               return $row['count'];
+       }
+
+       /**
+        * @brief Returns the SQL condition string built from the provided condition array
+        *
+        * This function operates with two modes.
+        * - Supplied with a filed/value associative array, it builds simple strict
+        *   equality conditions linked by AND.
+        * - Supplied with a flat list, the first element is the condition string and
+        *   the following arguments are the values to be interpolated
+        *
+        * $condition = ["uid" => 1, "network" => 'dspr'];
+        * or:
+        * $condition = ["`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr'];
+        *
+        * In either case, the provided array is left with the parameters only
+        *
+        * @param array $condition
+        * @return string
+        */
+       private static function buildCondition(array &$condition = [])
+       {
+               $condition_string = '';
+               if (count($condition) > 0) {
+                       $array_element = each($condition);
+                       $array_key = $array_element['key'];
+                       if (is_int($array_key)) {
+                               $condition_string = " WHERE ".array_shift($condition);
+                       } else {
+                               $condition_string = " WHERE `".implode("` = ? AND `", array_keys($condition))."` = ?";
+                       }
+               }
+
+               return $condition_string;
+       }
 
        /**
         * @brief Fills an array with data from a query
index dde3dc6f18be5c66fa15efc1546c22794fb7dd35..dae54835f0ad585d3390682257138744568c2bff 100644 (file)
@@ -1,5 +1,7 @@
 <?php
-
+/**
+ * @file include/dbstructure.php
+ */
 use Friendica\App;
 use Friendica\Core\System;
 use Friendica\Core\Config;
@@ -77,30 +79,10 @@ function update_fail($update_id, $error_message) {
                        'to_email' => $admin['email'],
                        'preamble' => $preamble,
                        'body' => $body,
-                       'language' => $lang,
-               ));
+                       'language' => $lang)
+               );
        }
 
-
-
-
-       /*
-        @TODO deprecated code?
-       $email_tpl = get_intltext_template("update_fail_eml.tpl");
-       $email_msg = replace_macros($email_tpl, array(
-               '$sitename' => $a->config['sitename'],
-               '$siteurl' =>  System::baseUrl(),
-               '$update' => DB_UPDATE_VERSION,
-               '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
-       ));
-       $subject=sprintf(t('Update Error at %s'), System::baseUrl());
-       require_once('include/email.php');
-       $subject = email_header_encode($subject,'UTF-8');
-       mail($a->config['admin_email'], $subject, $email_msg,
-               'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
-               .'Content-type: text/plain; charset=UTF-8'."\n"
-               .'Content-transfer-encoding: 8bit');
-       */
        //try the logger
        logger("CRITICAL: Database structure update failed: ".$retval);
 }
@@ -849,6 +831,7 @@ function db_definition() {
                        "indexes" => array(
                                        "PRIMARY" => array("item-uri"),
                                        "conversation-uri" => array("conversation-uri"),
+                                       "received" => array("received"),
                                        )
                        );
        $database["event"] = array(
@@ -905,29 +888,6 @@ function db_definition() {
                                        "url" => array("UNIQUE", "url(190)"),
                                        )
                        );
-       $database["ffinder"] = array(
-                       "fields" => array(
-                                       "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
-                                       "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
-                                       "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
-                                       ),
-                       "indexes" => array(
-                                       "PRIMARY" => array("id"),
-                                       )
-                       );
-       $database["fserver"] = array(
-                       "fields" => array(
-                                       "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
-                                       "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
-                                       "key" => array("type" => "text"),
-                                       ),
-                       "indexes" => array(
-                                       "PRIMARY" => array("id"),
-                                       "server" => array("server(32)"),
-                                       )
-                       );
        $database["fsuggest"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
@@ -1189,22 +1149,6 @@ function db_definition() {
                                        "uid_ownerlink" => array("uid","owner-link(190)"),
                                        )
                        );
-       $database["item_id"] = array(
-                       "fields" => array(
-                                       "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
-                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
-                                       "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
-                                       "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
-                                       ),
-                       "indexes" => array(
-                                       "PRIMARY" => array("id"),
-                                       "uid" => array("uid"),
-                                       "sid" => array("sid(32)"),
-                                       "service" => array("service(32)"),
-                                       "iid" => array("iid"),
-                                       )
-                       );
        $database["locks"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
@@ -1579,23 +1523,6 @@ function db_definition() {
                                        "iid" => array("UNIQUE", "iid"),
                                        )
                        );
-       $database["spam"] = array(
-                       "fields" => array(
-                                       "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
-                                       "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
-                                       "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
-                                       "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
-                                       "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
-                                       ),
-                       "indexes" => array(
-                                       "PRIMARY" => array("id"),
-                                       "uid" => array("uid"),
-                                       "spam" => array("spam"),
-                                       "ham" => array("ham"),
-                                       "term" => array("term(32)"),
-                                       )
-                       );
        $database["term"] = array(
                        "fields" => array(
                                        "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
diff --git a/include/email.php b/include/email.php
deleted file mode 100644 (file)
index b3bd52a..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-<?php
-require_once('include/html2plain.php');
-require_once('include/msgclean.php');
-require_once('include/quoteconvert.php');
-
-function email_connect($mailbox,$username,$password) {
-       if (! function_exists('imap_open'))
-               return false;
-
-       $mbox = @imap_open($mailbox,$username,$password);
-
-       return $mbox;
-}
-
-function email_poll($mbox,$email_addr) {
-
-       if (! ($mbox && $email_addr))
-               return array();
-
-       $search1 = @imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID);
-       if (!$search1) {
-               $search1 = array();
-       } else {
-               logger("Found mails from ".$email_addr, LOGGER_DEBUG);
-       }
-
-       $search2 = @imap_search($mbox,'TO "' . $email_addr . '"', SE_UID);
-       if (!$search2) {
-               $search2 = array();
-       } else {
-               logger("Found mails to ".$email_addr, LOGGER_DEBUG);
-       }
-
-       $search3 = @imap_search($mbox,'CC "' . $email_addr . '"', SE_UID);
-       if (!$search3) {
-               $search3 = array();
-       } else {
-               logger("Found mails cc ".$email_addr, LOGGER_DEBUG);
-       }
-
-       $res = array_unique(array_merge($search1, $search2, $search3));
-
-       return $res;
-}
-
-
-function construct_mailbox_name($mailacct) {
-       $ret = '{' . $mailacct['server'] . ((intval($mailacct['port'])) ? ':' . $mailacct['port'] : '');
-       $ret .= (($mailacct['ssltype']) ?  '/' . $mailacct['ssltype'] . '/novalidate-cert' : '');
-       $ret .= '}' . $mailacct['mailbox'];
-       return $ret;
-}
-
-
-function email_msg_meta($mbox,$uid) {
-       $ret = (($mbox && $uid) ? @imap_fetch_overview($mbox,$uid,FT_UID) : array(array())); // POSSIBLE CLEANUP --> array(array()) is probably redundant now
-       return ((count($ret)) ? $ret : array());
-}
-
-function email_msg_headers($mbox,$uid) {
-       $raw_header = (($mbox && $uid) ? @imap_fetchheader($mbox,$uid,FT_UID) : '');
-       $raw_header = str_replace("\r",'',$raw_header);
-       $ret = array();
-       $h = explode("\n",$raw_header);
-       if (count($h))
-       foreach ($h as $line ) {
-           if (preg_match("/^[a-zA-Z]/", $line)) {
-                       $key = substr($line,0,strpos($line,':'));
-                       $value = substr($line,strpos($line,':')+1);
-
-                       $last_entry = strtolower($key);
-                       $ret[$last_entry] = trim($value);
-               }
-               else {
-                       $ret[$last_entry] .= ' ' . trim($line);
-       }
-       }
-       return $ret;
-}
-
-
-function email_get_msg($mbox,$uid, $reply) {
-       $ret = array();
-
-       $struc = (($mbox && $uid) ? @imap_fetchstructure($mbox,$uid,FT_UID) : null);
-
-       if (! $struc)
-               return $ret;
-
-       if (! $struc->parts) {
-               $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'html');
-               $html = $ret['body'];
-
-               if (trim($ret['body']) == '')
-                       $ret['body'] = email_get_part($mbox,$uid,$struc,0, 'plain');
-               else
-                       $ret['body'] = html2bbcode($ret['body']);
-       }
-       else {
-               $text = '';
-               $html = '';
-               foreach ($struc->parts as $ptop => $p) {
-                       $x = email_get_part($mbox,$uid,$p,$ptop + 1, 'plain');
-                       if ($x) {
-                               $text .= $x;
-                       }
-
-                       $x = email_get_part($mbox,$uid,$p,$ptop + 1, 'html');
-                       if ($x) {
-                               $html .= $x;
-                       }
-               }
-               if (trim($html) != '') {
-                       $ret['body'] = html2bbcode($html);
-               } else {
-                       $ret['body'] = $text;
-               }
-       }
-
-       $ret['body'] = removegpg($ret['body']);
-       $msg = removesig($ret['body']);
-       $ret['body'] = $msg['body'];
-       $ret['body'] = convertquote($ret['body'], $reply);
-
-       if (trim($html) != '') {
-               $ret['body'] = removelinebreak($ret['body']);
-       }
-
-       $ret['body'] = unifyattributionline($ret['body']);
-
-       return $ret;
-}
-
-// At the moment - only return plain/text.
-// Later we'll repackage inline images as data url's and make the HTML safe
-
-function email_get_part($mbox,$uid,$p,$partno, $subtype) {
-       // $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
-       global $htmlmsg,$plainmsg,$charset,$attachments;
-
-       //echo $partno."\n";
-
-       // DECODE DATA
-       $data = ($partno)
-               ? @imap_fetchbody($mbox,$uid,$partno, FT_UID|FT_PEEK)
-       : @imap_body($mbox,$uid,FT_UID|FT_PEEK);
-
-       // Any part may be encoded, even plain text messages, so check everything.
-       if ($p->encoding==4)
-               $data = quoted_printable_decode($data);
-       elseif ($p->encoding==3)
-               $data = base64_decode($data);
-
-       // PARAMETERS
-       // get all parameters, like charset, filenames of attachments, etc.
-       $params = array();
-       if ($p->parameters)
-               foreach ($p->parameters as $x)
-                       $params[strtolower($x->attribute)] = $x->value;
-       if (isset($p->dparameters) && $p->dparameters)
-               foreach ($p->dparameters as $x)
-                       $params[strtolower($x->attribute)] = $x->value;
-
-       // ATTACHMENT
-       // Any part with a filename is an attachment,
-       // so an attached text file (type 0) is not mistaken as the message.
-
-       if ((isset($params['filename']) && $params['filename']) || (isset($params['name']) && $params['name'])) {
-               // filename may be given as 'Filename' or 'Name' or both
-               $filename = ($params['filename'])? $params['filename'] : $params['name'];
-               // filename may be encoded, so see imap_mime_header_decode()
-               $attachments[$filename] = $data;  // this is a problem if two files have same name
-       }
-
-       // TEXT
-       if ($p->type == 0 && $data) {
-               // Messages may be split in different parts because of inline attachments,
-               // so append parts together with blank row.
-               if (strtolower($p->subtype)==$subtype) {
-                       $data = iconv($params['charset'], 'UTF-8//IGNORE', $data);
-                       return (trim($data) ."\n\n");
-               } else
-                       $data = '';
-
- //           $htmlmsg .= $data ."<br><br>";
-               $charset = $params['charset'];  // assume all parts are same charset
-       }
-
-       // EMBEDDED MESSAGE
-       // Many bounce notifications embed the original message as type 2,
-       // but AOL uses type 1 (multipart), which is not handled here.
-       // There are no PHP functions to parse embedded messages,
-       // so this just appends the raw source to the main message.
-//     elseif ($p->type==2 && $data) {
-//             $plainmsg .= $data."\n\n";
-//     }
-
-       // SUBPART RECURSION
-       if (isset($p->parts) && $p->parts) {
-               $x = "";
-               foreach ($p->parts as $partno0=>$p2) {
-                       $x .=  email_get_part($mbox,$uid,$p2,$partno . '.' . ($partno0+1), $subtype);  // 1.2, 1.2.1, etc.
-                       //if ($x) {
-                       //      return $x;
-                       //}
-               }
-               return $x;
-       }
-}
-
-
-
-function email_header_encode($in_str, $charset) {
-       $out_str = $in_str;
-       $need_to_convert = false;
-
-       for ($x = 0; $x < strlen($in_str); $x ++) {
-               if ((ord($in_str[$x]) == 0) || ((ord($in_str[$x]) > 128))) {
-                       $need_to_convert = true;
-               }
-       }
-
-       if (! $need_to_convert)
-               return $in_str;
-
-    if ($out_str && $charset) {
-
-        // define start delimimter, end delimiter and spacer
-        $end = "?=";
-        $start = "=?" . $charset . "?B?";
-        $spacer = $end . "\r\n " . $start;
-
-        // determine length of encoded text within chunks
-        // and ensure length is even
-        $length = 75 - strlen($start) - strlen($end);
-
-        /*
-            [EDIT BY danbrown AT php DOT net: The following
-            is a bugfix provided by (gardan AT gmx DOT de)
-            on 31-MAR-2005 with the following note:
-            "This means: $length should not be even,
-            but divisible by 4. The reason is that in
-            base64-encoding 3 8-bit-chars are represented
-            by 4 6-bit-chars. These 4 chars must not be
-            split between two encoded words, according
-            to RFC-2047.
-        */
-        $length = $length - ($length % 4);
-
-        // encode the string and split it into chunks
-        // with spacers after each chunk
-        $out_str = base64_encode($out_str);
-        $out_str = chunk_split($out_str, $length, $spacer);
-
-        // remove trailing spacer and
-        // add start and end delimiters
-        $spacer = preg_quote($spacer,'/');
-        $out_str = preg_replace("/" . $spacer . "$/", "", $out_str);
-        $out_str = $start . $out_str . $end;
-    }
-    return $out_str;
-}
-
-/**
- * email_send is used by NETWORK_EMAIL and NETWORK_EMAIL2 code
- * (not to notify the user, but to send items to email contacts)
- *
- * @todo This could be changed to use the Emailer class
- */
-function email_send($addr, $subject, $headers, $item) {
-       //$headers .= 'MIME-Version: 1.0' . "\n";
-       //$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
-       //$headers .= 'Content-Type: text/plain; charset=UTF-8' . "\n";
-       //$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
-
-       $part = uniqid("", true);
-
-       $html    = prepare_body($item);
-
-       $headers .= "Mime-Version: 1.0\n";
-       $headers .= 'Content-Type: multipart/alternative; boundary="=_'.$part.'"'."\n\n";
-
-       $body = "\n--=_".$part."\n";
-       $body .= "Content-Transfer-Encoding: 8bit\n";
-       $body .= "Content-Type: text/plain; charset=utf-8; format=flowed\n\n";
-
-       $body .= html2plain($html)."\n";
-
-       $body .= "--=_".$part."\n";
-       $body .= "Content-Transfer-Encoding: 8bit\n";
-       $body .= "Content-Type: text/html; charset=utf-8\n\n";
-
-       $body .= '<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">'.$html."</body></html>\n";
-
-       $body .= "--=_".$part."--";
-
-       //$message = '<html><body>' . $html . '</body></html>';
-       //$message = html2plain($html);
-       logger('notifier: email delivery to ' . $addr);
-       mail($addr, $subject, $body, $headers);
-}
-
-function iri2msgid($iri) {
-       if (!strpos($iri, "@"))
-               $msgid = preg_replace("/urn:(\S+):(\S+)\.(\S+):(\d+):(\S+)/i", "urn!$1!$4!$5@$2.$3", $iri);
-       else
-               $msgid = $iri;
-       return($msgid);
-}
-
-function msgid2iri($msgid) {
-       if (strpos($msgid, "@"))
-               $iri = preg_replace("/urn!(\S+)!(\d+)!(\S+)@(\S+)\.(\S+)/i", "urn:$1:$4.$5:$2:$3", $msgid);
-       else
-               $iri = $msgid;
-       return($iri);
-}
index dc030fa8b8985b77ed7a446dafcf864c6869586d..99d5ea0ab3939504f7458cac9a919efe46e613a3 100644 (file)
@@ -8,7 +8,6 @@ use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Util\Emailer;
 
-require_once 'include/email.php';
 require_once 'include/bbcode.php';
 require_once 'include/html2bbcode.php';
 
index a0509aa0fee048261f378e18bf0b1a66c0022415..4795867b129dde88fde5a377f34a7ff000cc113b 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -899,7 +900,7 @@ function widget_events() {
         * for exporting the cal is enabled (otherwise the widget would appear for logged in users
         * on foreigen profile pages even if the widget is disabled).
         */
-       if (intval($owner_uid) && local_user() !== $owner_uid && ! feature_enabled($owner_uid, "export_calendar")) {
+       if (intval($owner_uid) && local_user() !== $owner_uid && ! Feature::isEnabled($owner_uid, "export_calendar")) {
                return;
        }
 
@@ -907,7 +908,7 @@ function widget_events() {
         * If it's a kind of profile page (intval($owner_uid)) return if the user not logged in and
         * export feature isn't enabled.
         */
-       if (intval($owner_uid) && ! local_user() && ! feature_enabled($owner_uid, "export_calendar")) {
+       if (intval($owner_uid) && ! local_user() && ! Feature::isEnabled($owner_uid, "export_calendar")) {
                return;
        }
 
diff --git a/include/fcontact.php b/include/fcontact.php
deleted file mode 100644 (file)
index 7e93d06..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-use Friendica\Database\DBM;
-
-function fcontact_store($url,$name,$photo) {
-
-       $nurl = str_replace(array('https:','//www.'), array('http:','//'), $url);
-
-       $r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
-               dbesc($nurl)
-       );
-
-       if (DBM::is_result($r))
-               return $r[0]['id'];
-
-       $r = dba::insert('fcontact', array('url' => $nurl, 'name' => $name, 'photo' => $photo));
-
-       if (DBM::is_result($r)) {
-               $r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
-                       dbesc($nurl)
-               );
-               if (DBM::is_result($r))
-                       return $r[0]['id'];
-       }
-
-       return 0;
-}
-
-function ffinder_store($uid,$cid,$fid) {
-       $r = dba::insert('ffinder', array('uid' => $uid, 'cid' => $cid, 'fid' => $fid));
-       return $r;
-}
-
diff --git a/include/features.php b/include/features.php
deleted file mode 100644 (file)
index e03dc4a..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-
-/**
- * @file include/features.php
- * @brief Features management
- */
-
-use Friendica\Core\Config;
-use Friendica\Core\PConfig;
-
-/**
- * @brief check if feature is enabled
- *
- * @return boolean
- */
-function feature_enabled($uid, $feature) {
-       $x = Config::get('feature_lock', $feature, false);
-
-       if ($x === false) {
-               $x = PConfig::get($uid, 'feature', $feature, false);
-       }
-       if ($x === false) {
-               $x = Config::get('feature', $feature, false);
-       }
-       if ($x === false) {
-               $x = get_feature_default($feature);
-       }
-
-       $arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
-       call_hooks('feature_enabled',$arr);
-       return($arr['enabled']);
-}
-
-/**
- * @brief check if feature is enabled or disabled by default
- *
- * @param string $feature
- * @return boolean
- */
-function get_feature_default($feature) {
-       $f = get_features();
-       foreach ($f as $cat) {
-               foreach ($cat as $feat) {
-                       if (is_array($feat) && $feat[0] === $feature)
-                               return $feat[3];
-               }
-       }
-       return false;
-}
-
-/**
- * @brief Get a list of all available features
- *
- * The array includes the setting group, the setting name,
- * explainations for the setting and if it's enabled or disabled
- * by default
- *
- * @param bool $filtered True removes any locked features
- *
- * @return array
- */
-function get_features($filtered = true) {
-
-       $arr = array(
-
-               // General
-               'general' => array(
-                       t('General Features'),
-                       //array('expire',         t('Content Expiration'),              t('Remove old posts/comments after a period of time')),
-                       array('multi_profiles', t('Multiple Profiles'),                 t('Ability to create multiple profiles'), false, Config::get('feature_lock','multi_profiles', false)),
-                       array('photo_location', t('Photo Location'),                    t('Photo metadata is normally stripped. This extracts the location (if present) prior to stripping metadata and links it to a map.'), false, Config::get('feature_lock','photo_location', false)),
-                       array('export_calendar', t('Export Public Calendar'),           t('Ability for visitors to download the public calendar'), false, Config::get('feature_lock','export_calendar', false)),
-               ),
-
-               // Post composition
-               'composition' => array(
-                       t('Post Composition Features'),
-                       array('preview',        t('Post Preview'),                      t('Allow previewing posts and comments before publishing them'), false, Config::get('feature_lock','preview', false)),
-                       array('aclautomention', t('Auto-mention Forums'),               t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, Config::get('feature_lock','aclautomention', false)),
-               ),
-
-               // Network sidebar widgets
-               'widgets' => array(
-                       t('Network Sidebar Widgets'),
-                       array('archives',       t('Search by Date'),                    t('Ability to select posts by date ranges'), false, Config::get('feature_lock','archives', false)),
-                       array('forumlist_widget', t('List Forums'),                     t('Enable widget to display the forums your are connected with'), true, Config::get('feature_lock','forumlist_widget', false)),
-                       array('groups',         t('Group Filter'),                      t('Enable widget to display Network posts only from selected group'), false, Config::get('feature_lock','groups', false)),
-                       array('networks',       t('Network Filter'),                    t('Enable widget to display Network posts only from selected network'), false, Config::get('feature_lock','networks', false)),
-                       array('savedsearch',    t('Saved Searches'),                    t('Save search terms for re-use'), false, Config::get('feature_lock','savedsearch', false)),
-               ),
-
-               // Network tabs
-               'net_tabs' => array(
-                       t('Network Tabs'),
-                       array('personal_tab',   t('Network Personal Tab'),              t('Enable tab to display only Network posts that you\'ve interacted on'), false, Config::get('feature_lock','personal_tab', false)),
-                       array('new_tab',        t('Network New Tab'),                   t('Enable tab to display only new Network posts (from the last 12 hours)'), false, Config::get('feature_lock','new_tab', false)),
-                       array('link_tab',       t('Network Shared Links Tab'),          t('Enable tab to display only Network posts with links in them'), false, Config::get('feature_lock','link_tab', false)),
-               ),
-
-               // Item tools
-               'tools' => array(
-                       t('Post/Comment Tools'),
-                       array('multi_delete',   t('Multiple Deletion'),                 t('Select and delete multiple posts/comments at once'), false, Config::get('feature_lock','multi_delete', false)),
-                       array('edit_posts',     t('Edit Sent Posts'),                   t('Edit and correct posts and comments after sending'), false, Config::get('feature_lock','edit_posts', false)),
-                       array('commtag',        t('Tagging'),                           t('Ability to tag existing posts'), false, Config::get('feature_lock','commtag', false)),
-                       array('categories',     t('Post Categories'),                   t('Add categories to your posts'), false, Config::get('feature_lock','categories', false)),
-                       array('filing',         t('Saved Folders'),                     t('Ability to file posts under folders'), false, Config::get('feature_lock','filing', false)),
-                       array('dislike',        t('Dislike Posts'),                     t('Ability to dislike posts/comments'), false, Config::get('feature_lock','dislike', false)),
-                       array('star_posts',     t('Star Posts'),                        t('Ability to mark special posts with a star indicator'), false, Config::get('feature_lock','star_posts', false)),
-                       array('ignore_posts',   t('Mute Post Notifications'),           t('Ability to mute notifications for a thread'), false, Config::get('feature_lock','ignore_posts', false)),
-               ),
-
-               // Advanced Profile Settings
-               'advanced_profile' => array(
-                       t('Advanced Profile Settings'),
-                       array('forumlist_profile', t('List Forums'),                    t('Show visitors public community forums at the Advanced Profile Page'), false, Config::get('feature_lock','forumlist_profile', false)),
-                       array('tagadelic',      t('Tag Cloud'),                         t('Provide a personal tag cloud on your profile page'), false, Config::get('feature_lock', 'tagadelic', false)),
-               ),
-       );
-
-       // removed any locked features and remove the entire category if this makes it empty
-
-       if ($filtered) {
-               foreach ($arr as $k => $x) {
-                       $has_items = false;
-                       $kquantity = count($arr[$k]);
-                       for ($y = 0; $y < $kquantity; $y ++) {
-                               if (is_array($arr[$k][$y])) {
-                                       if ($arr[$k][$y][4] === false) {
-                                               $has_items = true;
-                                       } else {
-                                               unset($arr[$k][$y]);
-                                       }
-                               }
-                       }
-                       if (! $has_items) {
-                               unset($arr[$k]);
-                       }
-               }
-       }
-
-       call_hooks('get_features',$arr);
-       return $arr;
-}
index ac07c4085eaff752d8bc1e25643a3a952a34cdca..14b9c68ed59fd3476154a2ec367ab84d63adde71 100644 (file)
@@ -12,9 +12,9 @@ use Friendica\Object\Contact;
 use Friendica\Protocol\Diaspora;
 use Friendica\Protocol\OStatus;
 use Friendica\Protocol\PortableContact;
+use Friendica\Protocol\Salmon;
 
 require_once 'include/group.php';
-require_once 'include/salmon.php';
 
 function update_contact($id) {
        /*
@@ -268,7 +268,7 @@ function new_contact($uid, $url, $interactive = false, $network = '') {
                        $item['verb'] = ACTIVITY_FOLLOW;
                        $item['follow'] = $contact["url"];
                        $slap = OStatus::salmon($item, $r[0]);
-                       slapper($r[0], $contact['notify'], $slap);
+                       Salmon::slapper($r[0], $contact['notify'], $slap);
                }
 
                if ($contact['network'] == NETWORK_DIASPORA) {
index 3066b71130fca3b3746bfe53dbd870f989b4ec45..a3a007cc18a12c0edf97239ce9f5ffc77898fac1 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Content\ForumManager;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
@@ -309,7 +310,7 @@ function profile_sidebar($profile, $block = 0)
        }
 
        // show edit profile to yourself
-       if (!$is_contact && $profile['uid'] == local_user() && feature_enabled(local_user(), 'multi_profiles')) {
+       if (!$is_contact && $profile['uid'] == local_user() && Feature::isEnabled(local_user(), 'multi_profiles')) {
                $profile['edit'] = array(System::baseUrl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
                $r = q(
                        "SELECT * FROM `profile` WHERE `uid` = %d",
@@ -336,7 +337,7 @@ function profile_sidebar($profile, $block = 0)
                        }
                }
        }
-       if (!$is_contact && $profile['uid'] == local_user() && !feature_enabled(local_user(), 'multi_profiles')) {
+       if (!$is_contact && $profile['uid'] == local_user() && !Feature::isEnabled(local_user(), 'multi_profiles')) {
                $profile['edit'] = array(System::baseUrl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile'));
                $profile['menu'] = array(
                        'chg_photo' => t('Change profile photo'),
@@ -790,7 +791,7 @@ function advanced_profile(App $a)
                }
 
                //show subcribed forum if it is enabled in the usersettings
-               if (feature_enabled($uid, 'forumlist_profile')) {
+               if (Feature::isEnabled($uid, 'forumlist_profile')) {
                        $profile['forumlist'] = array( t('Forums:'), ForumManager::profileAdvanced($uid));
                }
 
index d446d2773d4c8d4bc0d6bcf24c55d8a33d124d85..61a9c7a1fab5fab034050cd703a73f50df9b2e52 100644 (file)
@@ -4,6 +4,7 @@
  */
 use Friendica\App;
 use Friendica\ParseUrl;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
@@ -17,12 +18,10 @@ use Friendica\Util\Lock;
 
 require_once 'include/bbcode.php';
 require_once 'include/oembed.php';
-require_once 'include/salmon.php';
 require_once 'include/crypto.php';
 require_once 'include/tags.php';
 require_once 'include/files.php';
 require_once 'include/text.php';
-require_once 'include/email.php';
 require_once 'include/threads.php';
 require_once 'include/plaintext.php';
 require_once 'include/feed.php';
@@ -1152,6 +1151,19 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
  * @param array $arr Contains the just posted item record
  */
 function item_set_last_item($arr) {
+       // Unarchive the author
+       $contact = dba::select('contact', [], ['id' => $arr["author-link"]], ['limit' => 1]);
+       if ($contact['term-date'] > NULL_DATE) {
+                Contact::unmarkForArchival($contact);
+       }
+
+       // Unarchive the contact if it is a toplevel posting
+       if ($arr["parent-uri"] === $arr["uri"]) {
+               $contact = dba::select('contact', [], ['id' => $arr["contact-id"]], ['limit' => 1]);
+               if ($contact['term-date'] > NULL_DATE) {
+                        Contact::unmarkForArchival($contact);
+               }
+       }
 
        $update = (!$arr['private'] && (($arr["author-link"] === $arr["owner-link"]) || ($arr["parent-uri"] === $arr["uri"])));
 
@@ -1680,8 +1692,8 @@ function new_follower($importer, $contact, $datarray, $item, $sharing = false) {
                        dbesc($name),
                        dbesc($nick),
                        dbesc($photo),
-                       dbesc(($sharing) ? NETWORK_ZOT : NETWORK_OSTATUS),
-                       intval(($sharing) ? CONTACT_IS_SHARING : CONTACT_IS_FOLLOWER)
+                       dbesc(NETWORK_OSTATUS),
+                       intval(CONTACT_IS_FOLLOWER)
                );
                $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `pending` = 1 LIMIT 1",
                                intval($importer['uid']),
@@ -2221,7 +2233,6 @@ function drop_item($id, $interactive = true) {
 
                // Now delete them
                if ($parentid != "") {
-                       $r = q("DELETE FROM `item_id` WHERE `iid` IN (%s)", dbesc($parentid));
                        $r = q("DELETE FROM `sign` WHERE `iid` IN (%s)", dbesc($parentid));
                }
 
@@ -2357,7 +2368,7 @@ function posted_dates($uid, $wall) {
 function posted_date_widget($url, $uid, $wall) {
        $o = '';
 
-       if (! feature_enabled($uid, 'archives')) {
+       if (! Feature::isEnabled($uid, 'archives')) {
                return $o;
        }
 
index 411f0ac5da5c28d1341d9d3e43165b11385b01d3..58ec150e7ad21bbbdbadaee68240e908b8f92ae6 100644 (file)
@@ -1,6 +1,9 @@
 <?php
-
+/**
+ * @file include/nav.php
+ */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -190,7 +193,7 @@ function nav_info(App $a)
 
                $nav['settings'] = array('settings', t('Settings'), '', t('Account settings'));
 
-               if (feature_enabled(local_user(), 'multi_profiles')) {
+               if (Feature::isEnabled(local_user(), 'multi_profiles')) {
                        $nav['profiles'] = array('profiles', t('Profiles'), '', t('Manage/Edit Profiles'));
                }
 
@@ -206,7 +209,7 @@ function nav_info(App $a)
 
        // Provide a banner/logo/whatever
        $banner = Config::get('system', 'banner');
-       if ($banner === false) {
+       if (is_null($banner)) {
                $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
        }
 
index 52e3409573347db9754dc7f1249fb09a95f14f5b..45f5d4e79a9c4572e63d35bc88c92879a44f7661 100644 (file)
@@ -126,8 +126,8 @@ function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array())
        if (x($opts, 'timeout')) {
                @curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
        } else {
-               $curl_time = intval(Config::get('system', 'curl_timeout'));
-               @curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
+               $curl_time = Config::get('system', 'curl_timeout', 60);
+               @curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
        }
 
        // by default we will allow self-signed certs
@@ -302,8 +302,8 @@ function post_url($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
        if (intval($timeout)) {
                curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
        } else {
-               $curl_time = intval(Config::get('system', 'curl_timeout'));
-               curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
+               $curl_time = Config::get('system', 'curl_timeout', 60);
+               curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
        }
 
        if (defined('LIGHTTPD')) {
diff --git a/include/oauth.php b/include/oauth.php
deleted file mode 100644 (file)
index 8834b93..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-/**
- * OAuth server
- * Based on oauth2-php <http://code.google.com/p/oauth2-php/>
- *
- */
-
-use Friendica\App;
-use Friendica\Core\Config;
-use Friendica\Core\PConfig;
-use Friendica\Core\System;
-use Friendica\Database\DBM;
-
-define('REQUEST_TOKEN_DURATION', 300);
-define('ACCESS_TOKEN_DURATION', 31536000);
-
-require_once("library/OAuth1.php");
-require_once("library/oauth2-php/lib/OAuth2.inc");
-
-class FKOAuthDataStore extends OAuthDataStore {
-  function gen_token(){
-               return md5(base64_encode(pack('N6', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid())));
-  }
-
-  function lookup_consumer($consumer_key) {
-               logger(__function__.":".$consumer_key);
-      //echo "<pre>"; var_dump($consumer_key); killme();
-
-               $r = q("SELECT client_id, pw, redirect_uri FROM clients WHERE client_id='%s'",
-                       dbesc($consumer_key)
-               );
-               if (DBM::is_result($r))
-                       return new OAuthConsumer($r[0]['client_id'],$r[0]['pw'],$r[0]['redirect_uri']);
-               return null;
-  }
-
-  function lookup_token($consumer, $token_type, $token) {
-               logger(__function__.":".$consumer.", ". $token_type.", ".$token);
-               $r = q("SELECT id, secret,scope, expires, uid  FROM tokens WHERE client_id='%s' AND scope='%s' AND id='%s'",
-                       dbesc($consumer->key),
-                       dbesc($token_type),
-                       dbesc($token)
-               );
-               if (DBM::is_result($r)){
-                       $ot=new OAuthToken($r[0]['id'],$r[0]['secret']);
-                       $ot->scope=$r[0]['scope'];
-                       $ot->expires = $r[0]['expires'];
-                       $ot->uid = $r[0]['uid'];
-                       return $ot;
-               }
-               return null;
-  }
-
-  function lookup_nonce($consumer, $token, $nonce, $timestamp) {
-               //echo __file__.":".__line__."<pre>"; var_dump($consumer,$key); killme();
-               $r = q("SELECT id, secret  FROM tokens WHERE client_id='%s' AND id='%s' AND expires=%d",
-                       dbesc($consumer->key),
-                       dbesc($nonce),
-                       intval($timestamp)
-               );
-               if (DBM::is_result($r))
-                       return new OAuthToken($r[0]['id'],$r[0]['secret']);
-               return null;
-  }
-
-  function new_request_token($consumer, $callback = null) {
-               logger(__function__.":".$consumer.", ". $callback);
-               $key = $this->gen_token();
-               $sec = $this->gen_token();
-
-               if ($consumer->key){
-                       $k = $consumer->key;
-               } else {
-                       $k = $consumer;
-               }
-
-               $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d)",
-                               dbesc($key),
-                               dbesc($sec),
-                               dbesc($k),
-                               'request',
-                               intval(REQUEST_TOKEN_DURATION));
-               if (!$r) return null;
-               return new OAuthToken($key,$sec);
-  }
-
-  function new_access_token($token, $consumer, $verifier = null) {
-    logger(__function__.":".$token.", ". $consumer.", ". $verifier);
-
-    // return a new access token attached to this consumer
-    // for the user associated with this token if the request token
-    // is authorized
-    // should also invalidate the request token
-
-    $ret=Null;
-
-    // get user for this verifier
-    $uverifier = Config::get("oauth", $verifier);
-    logger(__function__.":".$verifier.",".$uverifier);
-    if (is_null($verifier) || ($uverifier!==false)){
-
-               $key = $this->gen_token();
-               $sec = $this->gen_token();
-               $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP()+%d, %d)",
-                               dbesc($key),
-                               dbesc($sec),
-                               dbesc($consumer->key),
-                               'access',
-                               intval(ACCESS_TOKEN_DURATION),
-                               intval($uverifier));
-               if ($r)
-                       $ret = new OAuthToken($key,$sec);
-       }
-
-
-       dba::delete('tokens', array('id' => $token->key));
-
-
-       if (!is_null($ret) && $uverifier!==false){
-               Config::delete("oauth", $verifier);
-       /*      $apps = PConfig::get($uverifier, "oauth", "apps");
-               if ($apps===false) $apps=array();
-               $apps[] = $consumer->key;
-               PConfig::set($uverifier, "oauth", "apps", $apps);*/
-       }
-
-    return $ret;
-
-  }
-}
-
-class FKOAuth1 extends OAuthServer {
-       function __construct() {
-               parent::__construct(new FKOAuthDataStore());
-               $this->add_signature_method(new OAuthSignatureMethod_PLAINTEXT());
-               $this->add_signature_method(new OAuthSignatureMethod_HMAC_SHA1());
-       }
-
-       function loginUser($uid){
-               logger("FKOAuth1::loginUser $uid");
-               $a = get_app();
-               $r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1",
-                       intval($uid)
-               );
-               if (DBM::is_result($r)){
-                       $record = $r[0];
-               } else {
-                  logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
-                   header('HTTP/1.0 401 Unauthorized');
-                   die('This api requires login');
-               }
-               $_SESSION['uid'] = $record['uid'];
-               $_SESSION['theme'] = $record['theme'];
-               $_SESSION['mobile-theme'] = PConfig::get($record['uid'], 'system', 'mobile_theme');
-               $_SESSION['authenticated'] = 1;
-               $_SESSION['page_flags'] = $record['page-flags'];
-               $_SESSION['my_url'] = System::baseUrl() . '/profile/' . $record['nickname'];
-               $_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
-               $_SESSION["allow_api"] = true;
-
-               //notice( t("Welcome back ") . $record['username'] . EOL);
-               $a->user = $record;
-
-               if (strlen($a->user['timezone'])) {
-                       date_default_timezone_set($a->user['timezone']);
-                       $a->timezone = $a->user['timezone'];
-               }
-
-               $r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1",
-                       intval($_SESSION['uid']));
-               if (DBM::is_result($r)) {
-                       $a->contact = $r[0];
-                       $a->cid = $r[0]['id'];
-                       $_SESSION['cid'] = $a->cid;
-               }
-               q("UPDATE `user` SET `login_date` = '%s' WHERE `uid` = %d",
-                       dbesc(datetime_convert()),
-                       intval($_SESSION['uid'])
-               );
-
-               call_hooks('logged_in', $a->user);
-       }
-
-}
old mode 100755 (executable)
new mode 100644 (file)
index 2e902a6ab0c2bbfd39bd2b8068474120a1c8a654..ae1ce009c11765654e3d4101462a3fb04abd2dee 100644 (file)
@@ -120,48 +120,90 @@ function load_translation_table($lang) {
 
 }}
 
-// translate string if translation exists
-
-if (! function_exists('t')) {
-function t($s) {
-
+/**
+ * @brief Return the localized version of the provided string with optional string interpolation
+ *
+ * This function takes a english string as parameter, and if a localized version
+ * exists for the current language, substitutes it before performing an eventual
+ * string interpolation (sprintf) with additional optional arguments.
+ *
+ * Usages:
+ * - t('This is an example')
+ * - t('URL %s returned no result', $url)
+ * - t('Current version: %s, new version: %s', $current_version, $new_version)
+ *
+ * @param string $s
+ * @return string
+ */
+function t($s)
+{
        $a = get_app();
 
-       if (x($a->strings,$s)) {
+       if (x($a->strings, $s)) {
                $t = $a->strings[$s];
-               return is_array($t)?$t[0]:$t;
+               $s = is_array($t) ? $t[0] : $t;
        }
+       if (func_num_args() > 1) {
+               $args = array_slice(func_get_args(), 1);
+               $s = @vsprintf($s, $args);
+       }
+
        return $s;
-}}
+}
 
-if (! function_exists('tt')){
-function tt($singular, $plural, $count){
+/**
+ * @brief Return the localized version of a singular/plural string with optional string interpolation
+ *
+ * This function takes two english strings as parameters, singular and plural, as
+ * well as a count. If a localized version exists for the current language, they
+ * are used instead. Discrimination between singular and plural is done using the
+ * localized function if any or the default one. Finally, a string interpolation
+ * is performed using the count as parameter.
+ *
+ * Usages:
+ * - tt('Like', 'Likes', $count)
+ * - tt("%s user deleted", "%s users deleted", count($users))
+ *
+ * @global type $lang
+ * @param string $singular
+ * @param string $plural
+ * @param int $count
+ * @return string
+ */
+function tt($singular, $plural, $count)
+{
        global $lang;
        $a = get_app();
 
-       if (x($a->strings,$singular)) {
+       if (x($a->strings, $singular)) {
                $t = $a->strings[$singular];
-               $f = 'string_plural_select_' . str_replace('-','_',$lang);
-               if (! function_exists($f))
-                       $f = 'string_plural_select_default';
-               $k = $f($count);
-               return is_array($t)?$t[$k]:$t;
-       }
-
-       if ($count!=1){
-               return $plural;
+               if (is_array($t)) {
+                       $plural_function = 'string_plural_select_' . str_replace('-', '_', $lang);
+                       if (function_exists($plural_function)) {
+                               $plural_function = 'string_plural_select_default';
+                       }
+                       $i = $plural_function($count);
+                       $s = $t[$i];
+               } else {
+                       $s = $t;
+               }
+       } elseif (string_plural_select_default($count)) {
+               $s = $plural;
        } else {
-               return $singular;
+               $s = $singular;
        }
-}}
+
+       $s = @sprintf($s, $count);
+
+       return $s;
+}
 
 // provide a fallback which will not collide with
 // a function defined in any language file
-
-if (! function_exists('string_plural_select_default')) {
-function string_plural_select_default($n) {
-       return ($n != 1);
-}}
+function string_plural_select_default($n)
+{
+       return $n != 1;
+}
 
 
 
diff --git a/include/pidfile.php b/include/pidfile.php
deleted file mode 100644 (file)
index 7157a6e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-class pidfile {
-       private $_file;
-       private $_running;
-
-       public function __construct($dir, $name) {
-               $this->_file = "$dir/$name.pid";
-
-               if (file_exists($this->_file)) {
-                       $pid = trim(@file_get_contents($this->_file));
-                       if (($pid != "") && posix_kill($pid, 0)) {
-                               $this->_running = true;
-                       }
-               }
-
-               if (! $this->_running) {
-                       $pid = getmypid();
-                       file_put_contents($this->_file, $pid);
-               }
-       }
-
-       public function __destruct() {
-               if ((! $this->_running) && file_exists($this->_file)) {
-                       @unlink($this->_file);
-               }
-       }
-
-       public function is_already_running() {
-               return $this->_running;
-       }
-
-       public function running_time() {
-               return(time() - @filectime($this->_file));
-       }
-
-       public function kill() {
-               if (file_exists($this->_file))
-                       return(posix_kill(file_get_contents($this->_file), SIGTERM));
-       }
-}
diff --git a/include/salmon.php b/include/salmon.php
deleted file mode 100644 (file)
index 264b92e..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-<?php
-/**
- * @file include/salmon.php
- */
-use Friendica\Network\Probe;
-use Friendica\Util\XML;
-
-require_once 'include/crypto.php';
-
-function get_salmon_key($uri, $keyhash)
-{
-       $ret = array();
-
-       logger('Fetching salmon key for '.$uri);
-
-       $arr = Probe::lrdd($uri);
-
-       if (is_array($arr)) {
-               foreach ($arr as $a) {
-                       if ($a['@attributes']['rel'] === 'magic-public-key') {
-                               $ret[] = $a['@attributes']['href'];
-                       }
-               }
-       } else {
-               return '';
-       }
-
-       // We have found at least one key URL
-       // If it's inline, parse it - otherwise get the key
-
-       if (count($ret) > 0) {
-               for ($x = 0; $x < count($ret); $x ++) {
-                       if (substr($ret[$x], 0, 5) === 'data:') {
-                               if (strstr($ret[$x], ',')) {
-                                       $ret[$x] = substr($ret[$x], strpos($ret[$x], ',') + 1);
-                               } else {
-                                       $ret[$x] = substr($ret[$x], 5);
-                               }
-                       } elseif (normalise_link($ret[$x]) == 'http://') {
-                               $ret[$x] = fetch_url($ret[$x]);
-                       }
-               }
-       }
-
-
-       logger('Key located: ' . print_r($ret, true));
-
-       if (count($ret) == 1) {
-               // We only found one one key so we don't care if the hash matches.
-               // If it's the wrong key we'll find out soon enough because
-               // message verification will fail. This also covers some older
-               // software which don't supply a keyhash. As long as they only
-               // have one key we'll be right.
-
-               return $ret[0];
-       } else {
-               foreach ($ret as $a) {
-                       $hash = base64url_encode(hash('sha256', $a));
-                       if ($hash == $keyhash) {
-                               return $a;
-                       }
-               }
-       }
-
-       return '';
-}
-
-
-
-function slapper($owner, $url, $slap)
-{
-       // does contact have a salmon endpoint?
-
-       if (! strlen($url)) {
-               return;
-       }
-
-       if (! $owner['sprvkey']) {
-               logger(sprintf("user '%s' (%d) does not have a salmon private key. Send failed.",
-               $owner['username'], $owner['uid']));
-               return;
-       }
-
-       logger('slapper called for '.$url.'. Data: ' . $slap);
-
-       // create a magic envelope
-
-       $data      = base64url_encode($slap);
-       $data_type = 'application/atom+xml';
-       $encoding  = 'base64url';
-       $algorithm = 'RSA-SHA256';
-       $keyhash   = base64url_encode(hash('sha256', salmon_key($owner['spubkey'])), true);
-
-       $precomputed = '.' . base64url_encode($data_type) . '.' . base64url_encode($encoding) . '.' . base64url_encode($algorithm);
-
-       // GNU Social format
-       $signature   = base64url_encode(rsa_sign($data . $precomputed, $owner['sprvkey']));
-
-       // Compliant format
-       $signature2  = base64url_encode(rsa_sign(str_replace('=', '', $data . $precomputed), $owner['sprvkey']));
-
-       // Old Status.net format
-       $signature3  = base64url_encode(rsa_sign($data, $owner['sprvkey']));
-
-       // At first try the non compliant method that works for GNU Social
-       $xmldata = array("me:env" => array("me:data" => $data,
-                       "@attributes" => array("type" => $data_type),
-                       "me:encoding" => $encoding,
-                       "me:alg" => $algorithm,
-                       "me:sig" => $signature,
-                       "@attributes2" => array("key_id" => $keyhash)));
-
-       $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env");
-
-       $salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
-
-       // slap them
-       post_url($url, $salmon, array(
-               'Content-type: application/magic-envelope+xml',
-               'Content-length: ' . strlen($salmon)
-       ));
-
-       $a = get_app();
-       $return_code = $a->get_curl_code();
-
-       // check for success, e.g. 2xx
-
-       if ($return_code > 299) {
-               logger('GNU Social salmon failed. Falling back to compliant mode');
-
-               // Now try the compliant mode that normally isn't used for GNU Social
-               $xmldata = array("me:env" => array("me:data" => $data,
-                               "@attributes" => array("type" => $data_type),
-                               "me:encoding" => $encoding,
-                               "me:alg" => $algorithm,
-                               "me:sig" => $signature2,
-                               "@attributes2" => array("key_id" => $keyhash)));
-
-               $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env");
-
-               $salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
-
-               // slap them
-               post_url($url, $salmon, array(
-                       'Content-type: application/magic-envelope+xml',
-                       'Content-length: ' . strlen($salmon)
-               ));
-               $return_code = $a->get_curl_code();
-       }
-
-       if ($return_code > 299) {
-               logger('compliant salmon failed. Falling back to old status.net');
-
-               // Last try. This will most likely fail as well.
-               $xmldata = array("me:env" => array("me:data" => $data,
-                               "@attributes" => array("type" => $data_type),
-                               "me:encoding" => $encoding,
-                               "me:alg" => $algorithm,
-                               "me:sig" => $signature3,
-                               "@attributes2" => array("key_id" => $keyhash)));
-
-               $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env");
-
-               $salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
-
-               // slap them
-               post_url($url, $salmon, array(
-                       'Content-type: application/magic-envelope+xml',
-                       'Content-length: ' . strlen($salmon))
-               );
-               $return_code = $a->get_curl_code();
-       }
-
-       logger('slapper for '.$url.' returned ' . $return_code);
-
-       if (! $return_code) {
-               return -1;
-       }
-
-       if (($return_code == 503) && (stristr($a->get_curl_headers(), 'retry-after'))) {
-               return -1;
-       }
-
-       return ((($return_code >= 200) && ($return_code < 300)) ? 0 : 1);
-}
index ba8770e6f97a96692a3f41419ac258da790f9a04..45a17f9c96791987d32465b44c557c105cba3572 100644 (file)
@@ -1,6 +1,9 @@
 <?php
-
+/**
+ * @file include/tags.php
+ */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Object\Contact;
@@ -302,7 +305,7 @@ function tagcloud_wall_widget($limit = 50) {
                return "";
        }
 
-       if(feature_enabled($a->profile['profile_uid'], 'tagadelic')) {
+       if(Feature::isEnabled($a->profile['profile_uid'], 'tagadelic')) {
                $owner_id = Contact::getIdForURL($a->profile['url']);
 
                if(!$owner_id) {
index 9a3d24bd1ec82fbe7febade1a9d6239b54727c51..b2e0ac30d46397a787acdd59ff151d67bde417e4 100644 (file)
@@ -1,6 +1,9 @@
 <?php
-
+/**
+ * @file include/text.php
+ */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Content\Smilies;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
@@ -1046,7 +1049,7 @@ function search($s, $id = 'search-box', $url = 'search', $save = false, $aside =
                        '$action_url' => $url,
                        '$search_label' => t('Search'),
                        '$save_label' => t('Save'),
-                       '$savedsearch' => feature_enabled(local_user(),'savedsearch'),
+                       '$savedsearch' => Feature::isEnabled(local_user(),'savedsearch'),
                        '$search_hint' => t('@name, !forum, #tags, content'),
                );
 
index 4e30eabe39ba37db5315b720ff271f22b8b49393..7effcd62ddd9da5f05f74b81cf95f681e8945a5b 100644 (file)
@@ -198,12 +198,6 @@ function import_account(App $a, $file) {
                                case NETWORK_DIASPORA:
                                        //  send relocate message (below)
                                        break;
-                               case NETWORK_ZOT:
-                                       /// @TODO handle zot network
-                                       break;
-                               case NETWORK_MAIL2:
-                                       /// @TODO ?
-                                       break;
                                case NETWORK_FEED:
                                case NETWORK_MAIL:
                                        // Nothing to do
diff --git a/include/user.php b/include/user.php
deleted file mode 100644 (file)
index 356f10a..0000000
+++ /dev/null
@@ -1,453 +0,0 @@
-<?php
-/**
- * @file include/user.php
- */
-use Friendica\Core\Config;
-use Friendica\Core\System;
-use Friendica\Database\DBM;
-use Friendica\Object\Photo;
-
-require_once 'include/network.php';
-require_once 'include/plugin.php';
-require_once 'include/text.php';
-require_once 'include/pgettext.php';
-require_once 'include/datetime.php';
-require_once 'include/enotify.php';
-
-function create_user($arr) {
-
-       // Required: { username, nickname, email } or { openid_url }
-
-       $a = get_app();
-       $result = array('success' => false, 'user' => null, 'password' => '', 'message' => '');
-
-       $using_invites = Config::get('system','invitation_only');
-       $num_invites   = Config::get('system','number_invites');
-
-
-       $invite_id  = ((x($arr,'invite_id'))  ? notags(trim($arr['invite_id']))  : '');
-       $username   = ((x($arr,'username'))   ? notags(trim($arr['username']))   : '');
-       $nickname   = ((x($arr,'nickname'))   ? notags(trim($arr['nickname']))   : '');
-       $email      = ((x($arr,'email'))      ? notags(trim($arr['email']))      : '');
-       $openid_url = ((x($arr,'openid_url')) ? notags(trim($arr['openid_url'])) : '');
-       $photo      = ((x($arr,'photo'))      ? notags(trim($arr['photo']))      : '');
-       $password   = ((x($arr,'password'))   ? trim($arr['password'])           : '');
-       $password1  = ((x($arr,'password1'))  ? trim($arr['password1'])          : '');
-       $confirm    = ((x($arr,'confirm'))    ? trim($arr['confirm'])            : '');
-       $blocked    = ((x($arr,'blocked'))    ? intval($arr['blocked'])  : 0);
-       $verified   = ((x($arr,'verified'))   ? intval($arr['verified']) : 0);
-
-       $publish    = ((x($arr,'profile_publish_reg') && intval($arr['profile_publish_reg'])) ? 1 : 0);
-       $netpublish = ((strlen(Config::get('system','directory'))) ? $publish : 0);
-
-       if ($password1 != $confirm) {
-               $result['message'] .= t('Passwords do not match. Password unchanged.') . EOL;
-               return $result;
-       } elseif ($password1 != "")
-               $password = $password1;
-
-       $tmp_str = $openid_url;
-
-       if($using_invites) {
-               if(! $invite_id) {
-                       $result['message'] .= t('An invitation is required.') . EOL;
-                       return $result;
-               }
-               $r = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1", dbesc($invite_id));
-               if(! results($r)) {
-                       $result['message'] .= t('Invitation could not be verified.') . EOL;
-                       return $result;
-               }
-       }
-
-       if((! x($username)) || (! x($email)) || (! x($nickname))) {
-               if($openid_url) {
-                       if(! validate_url($tmp_str)) {
-                               $result['message'] .= t('Invalid OpenID url') . EOL;
-                               return $result;
-                       }
-                       $_SESSION['register'] = 1;
-                       $_SESSION['openid'] = $openid_url;
-                       require_once('library/openid.php');
-                       $openid = new LightOpenID;
-                       $openid->identity = $openid_url;
-                       $openid->returnUrl = System::baseUrl() . '/openid';
-                       $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
-                       $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default');
-                       try {
-                               $authurl = $openid->authUrl();
-                       } catch (Exception $e){
-                               $result['message'] .= t("We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID."). EOL . EOL . t("The error message was:") . $e->getMessage() . EOL;
-                               return $result;
-                       }
-                       goaway($authurl);
-                       // NOTREACHED
-               }
-
-               notice( t('Please enter the required information.') . EOL );
-               return;
-       }
-
-       if(! validate_url($tmp_str))
-               $openid_url = '';
-
-
-       $err = '';
-
-       // collapse multiple spaces in name
-       $username = preg_replace('/ +/',' ',$username);
-
-       if(mb_strlen($username) > 48)
-               $result['message'] .= t('Please use a shorter name.') . EOL;
-       if(mb_strlen($username) < 3)
-               $result['message'] .= t('Name too short.') . EOL;
-
-       // So now we are just looking for a space in the full name.
-
-       $loose_reg = Config::get('system','no_regfullname');
-       if(! $loose_reg) {
-               $username = mb_convert_case($username,MB_CASE_TITLE,'UTF-8');
-               if(! strpos($username,' '))
-                       $result['message'] .= t("That doesn't appear to be your full \x28First Last\x29 name.") . EOL;
-       }
-
-
-       if(! allowed_email($email))
-               $result['message'] .= t('Your email domain is not among those allowed on this site.') . EOL;
-
-       if((! valid_email($email)) || (! validate_email($email)))
-               $result['message'] .= t('Not a valid email address.') . EOL;
-
-       // Disallow somebody creating an account using openid that uses the admin email address,
-       // since openid bypasses email verification. We'll allow it if there is not yet an admin account.
-
-       $adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
-
-       //if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0) && strlen($openid_url)) {
-       if((x($a->config,'admin_email')) && in_array(strtolower($email), $adminlist) && strlen($openid_url)) {
-               $r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1",
-                       dbesc($email)
-               );
-               if (DBM::is_result($r))
-                       $result['message'] .= t('Cannot use that email.') . EOL;
-       }
-
-       $nickname = $arr['nickname'] = strtolower($nickname);
-
-       if(! preg_match("/^[a-z0-9][a-z0-9\_]*$/",$nickname))
-               $result['message'] .= t('Your "nickname" can only contain "a-z", "0-9" and "_".') . EOL;
-
-       $r = q("SELECT `uid` FROM `user`
-               WHERE `nickname` = '%s' LIMIT 1",
-               dbesc($nickname)
-       );
-       if (DBM::is_result($r))
-               $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
-
-       // Check deleted accounts that had this nickname. Doesn't matter to us,
-       // but could be a security issue for federated platforms.
-
-       $r = q("SELECT * FROM `userd`
-               WHERE `username` = '%s' LIMIT 1",
-               dbesc($nickname)
-       );
-       if (DBM::is_result($r))
-               $result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
-
-       if(strlen($result['message'])) {
-               return $result;
-       }
-
-       $new_password = ((strlen($password)) ? $password : autoname(6) . mt_rand(100,9999));
-       $new_password_encoded = hash('whirlpool',$new_password);
-
-       $result['password'] = $new_password;
-
-       require_once('include/crypto.php');
-
-       $keys = new_keypair(4096);
-
-       if($keys === false) {
-               $result['message'] .= t('SERIOUS ERROR: Generation of security keys failed.') . EOL;
-               return $result;
-       }
-
-       $prvkey = $keys['prvkey'];
-       $pubkey = $keys['pubkey'];
-
-       // Create another keypair for signing/verifying salmon protocol messages.
-       $sres    = new_keypair(512);
-       $sprvkey = $sres['prvkey'];
-       $spubkey = $sres['pubkey'];
-
-       $r = q("INSERT INTO `user` (`guid`, `username`, `password`, `email`, `openid`, `nickname`,
-               `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone`, `default-location`)
-               VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '')",
-               dbesc(generate_user_guid()),
-               dbesc($username),
-               dbesc($new_password_encoded),
-               dbesc($email),
-               dbesc($openid_url),
-               dbesc($nickname),
-               dbesc($pubkey),
-               dbesc($prvkey),
-               dbesc($spubkey),
-               dbesc($sprvkey),
-               dbesc(datetime_convert()),
-               intval($verified),
-               intval($blocked)
-       );
-
-       if ($r) {
-               $r = q("SELECT * FROM `user`
-                       WHERE `username` = '%s' AND `password` = '%s' LIMIT 1",
-                       dbesc($username),
-                       dbesc($new_password_encoded)
-               );
-               if (DBM::is_result($r)) {
-                       $u = $r[0];
-                       $newuid = intval($r[0]['uid']);
-               }
-       }
-       else {
-               $result['message'] .=  t('An error occurred during registration. Please try again.') . EOL ;
-               return $result;
-       }
-
-       /**
-        * if somebody clicked submit twice very quickly, they could end up with two accounts
-        * due to race condition. Remove this one.
-        */
-
-       $r = q("SELECT `uid` FROM `user`
-               WHERE `nickname` = '%s' ",
-               dbesc($nickname)
-       );
-       if ((DBM::is_result($r)) && (count($r) > 1) && $newuid) {
-               $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
-               dba::delete('user', array('uid' => $newuid));
-               return $result;
-       }
-
-       if(x($newuid) !== false) {
-               $r = q("INSERT INTO `profile` ( `uid`, `profile-name`, `is-default`, `name`, `photo`, `thumb`, `publish`, `net-publish` )
-                       VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, %d ) ",
-                       intval($newuid),
-                       t('default'),
-                       1,
-                       dbesc($username),
-                       dbesc(System::baseUrl() . "/photo/profile/{$newuid}.jpg"),
-                       dbesc(System::baseUrl() . "/photo/avatar/{$newuid}.jpg"),
-                       intval($publish),
-                       intval($netpublish)
-
-               );
-               if ($r === false) {
-                       $result['message'] .=  t('An error occurred creating your default profile. Please try again.') . EOL;
-                       // Start fresh next time.
-                       dba::delete('user', array('uid' => $newuid));
-                       return $result;
-               }
-
-               // Create the self contact
-               user_create_self_contact($newuid);
-
-               // Create a group with no members. This allows somebody to use it
-               // right away as a default group for new contacts.
-
-               require_once('include/group.php');
-               group_add($newuid, t('Friends'));
-
-               $r = q("SELECT `id` FROM `group` WHERE `uid` = %d AND `name` = '%s'",
-                       intval($newuid),
-                       dbesc(t('Friends'))
-               );
-               if (DBM::is_result($r)) {
-                       $def_gid = $r[0]['id'];
-
-                       q("UPDATE `user` SET `def_gid` = %d WHERE `uid` = %d",
-                               intval($r[0]['id']),
-                               intval($newuid)
-                       );
-               }
-
-               if(Config::get('system', 'newuser_private') && $def_gid) {
-                       q("UPDATE `user` SET `allow_gid` = '%s' WHERE `uid` = %d",
-                               dbesc("<" . $def_gid . ">"),
-                               intval($newuid)
-                       );
-               }
-
-       }
-
-       // if we have no OpenID photo try to look up an avatar
-       if(! strlen($photo))
-               $photo = avatar_img($email);
-
-       // unless there is no avatar-plugin loaded
-       if (strlen($photo)) {
-               $photo_failure = false;
-
-               $filename = basename($photo);
-               $img_str = fetch_url($photo, true);
-               // guess mimetype from headers or filename
-               $type = Photo::guessImageType($photo, true);
-
-
-               $img = new Photo($img_str, $type);
-               if ($img->isValid()) {
-                       $img->scaleImageSquare(175);
-
-                       $hash = photo_new_resource();
-
-                       $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4);
-
-                       if ($r === false) {
-                               $photo_failure = true;
-                       }
-
-                       $img->scaleImage(80);
-
-                       $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
-
-                       if ($r === false) {
-                               $photo_failure = true;
-                       }
-
-                       $img->scaleImage(48);
-
-                       $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
-
-                       if ($r === false) {
-                               $photo_failure = true;
-                       }
-
-                       if (! $photo_failure) {
-                               q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
-                                       dbesc($hash)
-                               );
-                       }
-               }
-       }
-
-       call_hooks('register_account', $newuid);
-
-       $result['success'] = true;
-       $result['user'] = $u;
-       return $result;
-
-}
-
-/**
- * @brief create the "self" contact from data from the user table
- *
- * @param integer $uid
- */
-function user_create_self_contact($uid) {
-
-       // Only create the entry if it doesn't exist yet
-       $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($uid));
-       if (DBM::is_result($r)) {
-               return;
-       }
-
-       $r = q("SELECT `uid`, `username`, `nickname` FROM `user` WHERE `uid` = %d", intval($uid));
-       if (!DBM::is_result($r)) {
-               return;
-       }
-
-       $user = $r[0];
-
-       q("INSERT INTO `contact` (`uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
-               `addr`, `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness`)
-               VALUES (%d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0)",
-               intval($user['uid']),
-               datetime_convert(),
-               dbesc($user['username']),
-               dbesc($user['nickname']),
-               dbesc(System::baseUrl()."/photo/profile/".$user['uid'].".jpg"),
-               dbesc(System::baseUrl()."/photo/avatar/".$user['uid'].".jpg"),
-               dbesc(System::baseUrl()."/photo/micro/".$user['uid'].".jpg"),
-               dbesc(System::baseUrl()."/profile/".$user['nickname']),
-               dbesc(normalise_link(System::baseUrl()."/profile/".$user['nickname'])),
-               dbesc($user['nickname'].'@'.substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3)),
-               dbesc(System::baseUrl()."/dfrn_request/".$user['nickname']),
-               dbesc(System::baseUrl()."/dfrn_notify/".$user['nickname']),
-               dbesc(System::baseUrl()."/dfrn_poll/".$user['nickname']),
-               dbesc(System::baseUrl()."/dfrn_confirm/".$user['nickname']),
-               dbesc(System::baseUrl()."/poco/".$user['nickname']),
-               dbesc(datetime_convert()),
-               dbesc(datetime_convert()),
-               dbesc(datetime_convert())
-       );
-}
-
-/**
- * @brief send registration confiÅ•mation with the intormation that reg is pending
- *
- * @param string $email
- * @param string $sitename
- * @param string $username
- * @return NULL|boolean from notification() and email() inherited
- */
-function send_register_pending_eml($email, $sitename, $username) {
-       $body = deindent(t('
-               Dear %1$s,
-                       Thank you for registering at %2$s. Your account is pending for approval by the administrator.
-       '));
-
-       $body = sprintf($body, $username, $sitename);
-
-       return notification(array(
-               'type' => SYSTEM_EMAIL,
-               'to_email' => $email,
-               'subject'=> sprintf( t('Registration at %s'), $sitename),
-               'body' => $body));
-}
-
-/*
- * send registration confirmation.
- * It's here as a function because the mail is sent
- * from different parts
- */
-function send_register_open_eml($email, $sitename, $siteurl, $username, $password){
-       $preamble = deindent(t('
-               Dear %1$s,
-                       Thank you for registering at %2$s. Your account has been created.
-       '));
-       $body = deindent(t('
-               The login details are as follows:
-                       Site Location:  %3$s
-                       Login Name:     %1$s
-                       Password:       %5$s
-
-               You may change your password from your account "Settings" page after logging
-               in.
-
-               Please take a few moments to review the other account settings on that page.
-
-               You may also wish to add some basic information to your default profile
-               (on the "Profiles" page) so that other people can easily find you.
-
-               We recommend setting your full name, adding a profile photo,
-               adding some profile "keywords" (very useful in making new friends) - and
-               perhaps what country you live in; if you do not wish to be more specific
-               than that.
-
-               We fully respect your right to privacy, and none of these items are necessary.
-               If you are new and do not know anybody here, they may help
-               you to make some new and interesting friends.
-
-
-               Thank you and welcome to %2$s.'));
-
-               $preamble = sprintf($preamble, $username, $sitename);
-               $body = sprintf($body, $email, $sitename, $siteurl, $username, $password);
-
-               return notification(array(
-                       'type' => SYSTEM_EMAIL,
-                       'to_email' => $email,
-                       'subject'=> sprintf( t('Registration details for %s'), $sitename),
-                       'preamble'=> $preamble,
-                       'body' => $body));
-}
index 4b034b8cccdc83992957a8f6daa54903e36f560d..29e10bda8301088be9b97f74c196008b69d3b69a 100644 (file)
@@ -1,17 +1,17 @@
 <?php
-
- /**
+/**
  * @file mod/admin.php
  *
  * @brief Friendica admin
  */
-
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
+use Friendica\Object\Contact;
 
 require_once 'include/enotify.php';
 require_once 'include/text.php';
@@ -30,16 +30,15 @@ require_once 'include/items.php';
  * @param App $a
  *
  */
-function admin_post(App $a) {
-
-
+function admin_post(App $a)
+{
        if (!is_site_admin()) {
                return;
        }
 
        // do not allow a page manager to access the admin panel at all.
 
-       if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
+       if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
                return;
        }
 
@@ -54,14 +53,14 @@ function admin_post(App $a) {
                                break;
                        case 'plugins':
                                if ($a->argc > 2 &&
-                                       is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")) {
-                                               @include_once("addon/".$a->argv[2]."/".$a->argv[2].".php");
-                                               if (function_exists($a->argv[2].'_plugin_admin_post')) {
-                                                       $func = $a->argv[2].'_plugin_admin_post';
-                                                       $func($a);
-                                               }
+                                       is_file("addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php")) {
+                                       @include_once("addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php");
+                                       if (function_exists($a->argv[2] . '_plugin_admin_post')) {
+                                               $func = $a->argv[2] . '_plugin_admin_post';
+                                               $func($a);
+                                       }
                                }
-                               goaway('admin/plugins/'.$a->argv[2]);
+                               goaway('admin/plugins/' . $a->argv[2]);
                                return; // NOTREACHED
                                break;
                        case 'themes':
@@ -75,7 +74,9 @@ function admin_post(App $a) {
 
                                $theme = $a->argv[2];
                                if (is_file("view/theme/$theme/config.php")) {
-                                       function __call_theme_admin_post(App $a, $theme) {
+
+                                       function __call_theme_admin_post(App $a, $theme)
+                                       {
                                                $orig_theme = $a->theme;
                                                $orig_page = $a->page;
                                                $orig_session_theme = $_SESSION['theme'];
@@ -84,7 +85,7 @@ function admin_post(App $a) {
                                                $_SESSION['theme'] = $theme;
 
 
-                                               $init = $theme."_init";
+                                               $init = $theme . "_init";
                                                if (function_exists($init)) {
                                                        $init($a);
                                                }
@@ -103,7 +104,7 @@ function admin_post(App $a) {
                                if (is_ajax()) {
                                        return;
                                }
-                               goaway('admin/themes/'.$theme);
+                               goaway('admin/themes/' . $theme);
                                return;
                                break;
                        case 'features':
@@ -115,6 +116,9 @@ function admin_post(App $a) {
                        case 'dbsync':
                                admin_page_dbsync_post($a);
                                break;
+                       case 'contactblock':
+                               admin_page_contactblock_post($a);
+                               break;
                        case 'blocklist':
                                admin_page_blocklist_post($a);
                                break;
@@ -145,13 +149,13 @@ function admin_post(App $a) {
  * @param App $a
  * @return string
  */
-function admin_content(App $a) {
-
+function admin_content(App $a)
+{
        if (!is_site_admin()) {
                return login(false);
        }
 
-       if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
+       if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
                return "";
        }
 
@@ -160,9 +164,8 @@ function admin_content(App $a) {
        //      $toDelete = new APCIterator('user', APC_ITER_VALUE);
        //      apc_delete($toDelete);
        //}
-
        // Header stuff
-       $a->page['htmlhead'] .= replace_macros(get_markup_template('admin_settings_head.tpl'), array());
+       $a->page['htmlhead'] .= replace_macros(get_markup_template('admin/settings_head.tpl'), array());
 
        /*
         * Side bar links
@@ -171,25 +174,26 @@ function admin_content(App $a) {
        // array(url, name, extra css classes)
        // not part of $aside to make the template more adjustable
        $aside_sub = array(
-               'site'   =>     array("admin/site/", t("Site") , "site"),
-               'users'  =>     array("admin/users/", t("Users") , "users"),
-               'plugins'=>     array("admin/plugins/", t("Plugins") , "plugins"),
-               'themes' =>     array("admin/themes/", t("Themes") , "themes"),
-               'features' =>   array("admin/features/", t("Additional features") , "features"),
-               'dbsync' =>     array("admin/dbsync/", t('DB updates'), "dbsync"),
-               'queue'  =>     array("admin/queue/", t('Inspect Queue'), "queue"),
-               'blocklist' => array("admin/blocklist/", t('Server Blocklist'), "blocklist"),
-               'federation' => array("admin/federation/", t('Federation Statistics'), "federation"),
-               'deleteitem' => array("admin/deleteitem/", t('Delete Item'), 'deleteitem'),
+               'site'         => array("admin/site/"        , t("Site")                 , "site"),
+               'users'        => array("admin/users/"       , t("Users")                , "users"),
+               'plugins'      => array("admin/plugins/"     , t("Plugins")              , "plugins"),
+               'themes'       => array("admin/themes/"      , t("Themes")               , "themes"),
+               'features'     => array("admin/features/"    , t("Additional features")  , "features"),
+               'dbsync'       => array("admin/dbsync/"      , t('DB updates')           , "dbsync"),
+               'queue'        => array("admin/queue/"       , t('Inspect Queue')        , "queue"),
+               'contactblock' => array("admin/contactblock/", t('Contact Blocklist')    , "contactblock"),
+               'blocklist'    => array("admin/blocklist/"   , t('Server Blocklist')     , "blocklist"),
+               'federation'   => array("admin/federation/"  , t('Federation Statistics'), "federation"),
+               'deleteitem'   => array("admin/deleteitem/"  , t('Delete Item')          , 'deleteitem'),
        );
 
        /* get plugins admin page */
 
        $r = q("SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name`");
-       $aside_tools['plugins_admin']=array();
+       $aside_tools['plugins_admin'] = array();
        foreach ($r as $h) {
-               $plugin =$h['name'];
-               $aside_tools['plugins_admin'][] = array("admin/plugins/".$plugin, $plugin, "plugin");
+               $plugin = $h['name'];
+               $aside_tools['plugins_admin'][] = array("admin/plugins/" . $plugin, $plugin, "plugin");
                // temp plugins with admin
                $a->plugins_admin[] = $plugin;
        }
@@ -199,7 +203,7 @@ function admin_content(App $a) {
        $aside_tools['diagnostics_probe'] = array('probe/', t('probe address'), 'probe');
        $aside_tools['diagnostics_webfinger'] = array('webfinger/', t('check webfinger'), 'webfinger');
 
-       $t = get_markup_template("admin_aside.tpl");
+       $t = get_markup_template('admin/aside.tpl');
        $a->page['aside'] .= replace_macros($t, array(
                '$admin' => $aside_tools,
                '$subpages' => $aside_sub,
@@ -208,14 +212,10 @@ function admin_content(App $a) {
                '$logtxt' => t('Logs'),
                '$diagnosticstxt' => t('diagnostics'),
                '$h_pending' => t('User registrations waiting for confirmation'),
-               '$admurl'=> "admin/"
+               '$admurl' => "admin/"
        ));
 
-
-
-       /*
-        * Page content
-        */
+       // Page content
        $o = '';
        // urls
        if ($a->argc > 1) {
@@ -250,6 +250,9 @@ function admin_content(App $a) {
                        case 'federation':
                                $o = admin_page_federation($a);
                                break;
+                       case 'contactblock':
+                               $o = admin_page_contactblock($a);
+                               break;
                        case 'blocklist':
                                $o = admin_page_blocklist($a);
                                break;
@@ -283,19 +286,20 @@ function admin_content(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_blocklist(App $a) {
+function admin_page_blocklist(App $a)
+{
        $blocklist = Config::get('system', 'blocklist');
        $blocklistform = array();
        if (is_array($blocklist)) {
-               foreach($blocklist as $id => $b) {
+               foreach ($blocklist as $id => $b) {
                        $blocklistform[] = array(
                                'domain' => array("domain[$id]", t('Blocked domain'), $b['domain'], '', t('The blocked domain'), 'required', '', ''),
-                               'reason' => array("reason[$id]", t("Reason for the block"), $b['reason'], t('The reason why you blocked this domain.').'('.$b['domain'].')', 'required', '', ''),
-                               'delete' => array("delete[$id]", t("Delete domain").' ('.$b['domain'].')', False , t("Check to delete this entry from the blocklist"))
+                               'reason' => array("reason[$id]", t("Reason for the block"), $b['reason'], t('The reason why you blocked this domain.') . '(' . $b['domain'] . ')', 'required', '', ''),
+                               'delete' => array("delete[$id]", t("Delete domain") . ' (' . $b['domain'] . ')', False, t("Check to delete this entry from the blocklist"))
                        );
                }
        }
-       $t = get_markup_template("admin_blocklist.tpl");
+       $t = get_markup_template('admin/blocklist.tpl');
        return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Server Blocklist'),
@@ -313,7 +317,7 @@ function admin_page_blocklist(App $a) {
                '$entries' => $blocklistform,
                '$baseurl' => System::baseUrl(true),
                '$confirm_delete' => t('Delete entry from blocklist?'),
-               '$form_security_token'  => get_form_security_token("admin_blocklist")
+               '$form_security_token' => get_form_security_token("admin_blocklist")
        ));
 }
 
@@ -322,8 +326,9 @@ function admin_page_blocklist(App $a) {
  *
  * @param App $a
  */
-function admin_page_blocklist_post(App $a) {
-       if (!x($_POST,"page_blocklist_save") && (!x($_POST['page_blocklist_edit']))) {
+function admin_page_blocklist_post(App $a)
+{
+       if (!x($_POST, "page_blocklist_save") && (!x($_POST['page_blocklist_edit']))) {
                return;
        }
 
@@ -337,7 +342,7 @@ function admin_page_blocklist_post(App $a) {
                        'reason' => notags(trim($_POST['newentry_reason']))
                );
                Config::set('system', 'blocklist', $blocklist);
-               info(t('Server added to blocklist.').EOL);
+               info(t('Server added to blocklist.') . EOL);
        } else {
                // Edit the entries from blocklist
                $blocklist = array();
@@ -353,13 +358,93 @@ function admin_page_blocklist_post(App $a) {
                        }
                }
                Config::set('system', 'blocklist', $blocklist);
-               info(t('Site blocklist updated.').EOL);
+               info(t('Site blocklist updated.') . EOL);
        }
        goaway('admin/blocklist');
 
        return; // NOTREACHED
 }
 
+/**
+ * @brief Process data send by the contact block admin page
+ *
+ * @param App $a
+ */
+function admin_page_contactblock_post(App $a)
+{
+       $contact_url = x($_POST, 'contact_url') ? $_POST['contact_url'] : '';
+       $contacts    = x($_POST, 'contacts')    ? $_POST['contacts']    : [];
+
+       check_form_security_token_redirectOnErr('/admin/contactblock', 'admin_contactblock');
+
+       if (x($_POST, 'page_contactblock_block')) {
+               $contact_id = Contact::getIdForURL($contact_url, 0);
+               if ($contact_id) {
+                       Contact::block($contact_id);
+                       notice(t('The contact has been blocked from the node'));
+               } else {
+                       notice(t('Could not find any contact entry for this URL (%s)', $contact_url));
+               }
+       }
+       if (x($_POST, 'page_contactblock_unblock')) {
+               foreach ($contacts as $uid) {
+                       Contact::unblock($uid);
+               }
+               notice(tt("%s contact unblocked", "%s contacts unblocked", count($contacts)));
+       }
+       goaway('admin/contactblock');
+       return; // NOTREACHED
+}
+
+/**
+ * @brief Admin panel for server-wide contact block
+ *
+ * @param App $a
+ * @return string
+ */
+function admin_page_contactblock(App $a)
+{
+       $condition = ['uid' => 0, 'blocked' => true];
+
+       $total = dba::count('contact', $condition);
+
+       $a->set_pager_total($total);
+       $a->set_pager_itemspage(30);
+
+       $statement = dba::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
+
+       $contacts = dba::inArray($statement);
+
+       $t = get_markup_template('admin/contactblock.tpl');
+       $o = replace_macros($t, array(
+               // strings //
+               '$title'       => t('Administration'),
+               '$page'        => t('Remote Contact Blocklist'),
+               '$description' => t('This page allows you to prevent any message from a remote contact to reach your node.'),
+               '$submit'      => t('Block Remote Contact'),
+               '$select_all'  => t('select all'),
+               '$select_none' => t('select none'),
+               '$block'       => t('Block'),
+               '$unblock'     => t('Unblock'),
+               '$no_data'     => t('No remote contact is blocked from this node.'),
+
+               '$h_contacts'  => t('Blocked Remote Contacts'),
+               '$h_newblock'  => t('Block New Remote Contact'),
+               '$th_contacts' => [t('Photo'), t('Name'), t('Address'), t('Profile URL')],
+
+               '$form_security_token' => get_form_security_token("admin_contactblock"),
+
+               // values //
+               '$baseurl'    => System::baseUrl(true),
+
+               '$contacts'   => $contacts,
+               '$total_contacts' => tt('%s total blocked contact', '%s total blocked contacts', $total),
+               '$paginate'   => paginate($a),
+               '$contacturl' => ['contact_url', t("Profile URL"), '', t("URL of the remote contact to block.")],
+       ));
+       return $o;
+}
+
 /**
  * @brief Subpage where the admin can delete an item from their node given the GUID
  *
@@ -370,8 +455,9 @@ function admin_page_blocklist_post(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_deleteitem(App $a) {
-       $t = get_markup_template("admin_deleteitem.tpl");
+function admin_page_deleteitem(App $a)
+{
+       $t = get_markup_template('admin/deleteitem.tpl');
 
        return replace_macros($t, array(
                '$title' => t('Administration'),
@@ -381,9 +467,10 @@ function admin_page_deleteitem(App $a) {
                '$intro2' => t('You need to know the GUID of the item. You can find it e.g. by looking at the display URL. The last part of http://example.com/display/123456 is the GUID, here 123456.'),
                '$deleteitemguid' => array('deleteitemguid', t("GUID"), '', t("The GUID of the item you want to delete."), 'required', 'autofocus'),
                '$baseurl' => System::baseUrl(),
-               '$form_security_token'  => get_form_security_token("admin_deleteitem")
+               '$form_security_token' => get_form_security_token("admin_deleteitem")
        ));
 }
+
 /**
  * @brief Process send data from Admin Delete Item Page
  *
@@ -392,7 +479,8 @@ function admin_page_deleteitem(App $a) {
  *
  * @param App $a
  */
-function admin_page_deleteitem_post(App $a) {
+function admin_page_deleteitem_post(App $a)
+{
        if (!x($_POST['page_deleteitem_submit'])) {
                return;
        }
@@ -404,19 +492,19 @@ function admin_page_deleteitem_post(App $a) {
                // The GUID should not include a "/", so if there is one, we got an URL
                // and the last part of it is most likely the GUID.
                if (strpos($guid, '/')) {
-                       $guid = substr($guid, strrpos($guid, '/')+1);
+                       $guid = substr($guid, strrpos($guid, '/') + 1);
                }
                // Now that we have the GUID get all IDs of the associated entries in the
                // item table of the DB and drop those items, which will also delete the
                // associated threads.
-               $r = dba::select('item', array('id'), array('guid'=>$guid));
+               $r = dba::select('item', array('id'), array('guid' => $guid));
                while ($row = dba::fetch($r)) {
                        drop_item($row['id'], false);
                }
                dba::close($r);
        }
 
-       info(t('Item marked for deletion.').EOL);
+       info(t('Item marked for deletion.') . EOL);
        goaway('admin/deleteitem');
        return; // NOTREACHED
 }
@@ -435,7 +523,8 @@ function admin_page_deleteitem_post(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_federation(App $a) {
+function admin_page_federation(App $a)
+{
        // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
        // social and statusnet nodes this node is knowing
        //
@@ -445,15 +534,17 @@ function admin_page_federation(App $a) {
        // 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');
-       $colors    = array('Friendi%%a' => '#ffc018',     // orange from the logo
-                          'Diaspora'  => '#a1a1a1',     // logo is black and white, makes a gray
-                          '%%red%%'   => '#c50001',     // fire red from the logo
-                          'Hubzilla'  => '#43488a',     // blue from the logo
-                          'BlaBlaNet' => '#3B5998',     // blue from the navbar at blablanet-dot-com
-                          '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
+       $colors = array(
+               'Friendi%%a' => '#ffc018', // orange from the logo
+               'Diaspora'   => '#a1a1a1', // logo is black and white, makes a gray
+               '%%red%%'    => '#c50001', // fire red from the logo
+               'Hubzilla'   => '#43488a', // blue from the logo
+               'BlaBlaNet'  => '#3B5998', // blue from the navbar at blablanet-dot-com
+               '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
+       );
        $counts = array();
        $total = 0;
 
@@ -480,7 +571,7 @@ function admin_page_federation(App $a) {
                // to the version string for the displayed list.
                foreach ($v as $key => $value) {
                        if ($v[$key]['version'] == '') {
-                               $v[$key] = array('total'=>$v[$key]['total'], 'version'=>t('unknown'));
+                               $v[$key] = array('total' => $v[$key]['total'], 'version' => t('unknown'));
                        }
                }
                // in the DB the Diaspora versions have the format x.x.x.x-xx the last
@@ -503,7 +594,7 @@ function admin_page_federation(App $a) {
                                }
                        }
                        foreach ($newV as $key => $value) {
-                               array_push($newVv, array('total'=>$value, 'version'=>$key));
+                               array_push($newVv, array('total' => $value, 'version' => $key));
                        }
                        $v = $newVv;
                }
@@ -517,9 +608,9 @@ function admin_page_federation(App $a) {
                        foreach ($v as $vv) {
                                $newVC = $vv['total'];
                                $newVV = $vv['version'];
-                               $lastDot = strrpos($newVV,'.');
-                               $len = strlen($newVV)-1;
-                               if (($lastDot == $len-4) && (!strrpos($newVV,'-rc') == $len-3)) {
+                               $lastDot = strrpos($newVV, '.');
+                               $len = strlen($newVV) - 1;
+                               if (($lastDot == $len - 4) && (!strrpos($newVV, '-rc') == $len - 3)) {
                                        $newVV = substr($newVV, 0, $lastDot);
                                }
                                if (isset($newV[$newVV])) {
@@ -529,7 +620,7 @@ function admin_page_federation(App $a) {
                                }
                        }
                        foreach ($newV as $key => $value) {
-                               array_push($newVv, array('total'=>$value, 'version'=>$key));
+                               array_push($newVv, array('total' => $value, 'version' => $key));
                        }
                        $v = $newVv;
                }
@@ -539,7 +630,7 @@ function admin_page_federation(App $a) {
 
                // the 3rd array item is needed for the JavaScript graphs as JS does
                // not like some characters in the names of variables...
-               $counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p), $colors[$p]);
+               $counts[$p] = array($c[0], $v, str_replace(array(' ', '%'), '', $p), $colors[$p]);
        }
 
        // some helpful text
@@ -547,7 +638,7 @@ function admin_page_federation(App $a) {
        $hint = t('The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here.');
 
        // load the template, replace the macros and return the page content
-       $t = get_markup_template("admin_federation.tpl");
+       $t = get_markup_template('admin/federation.tpl');
        return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Federation Statistics'),
@@ -574,14 +665,15 @@ function admin_page_federation(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_queue(App $a) {
+function admin_page_queue(App $a)
+{
        // get content from the queue table
        $r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
                        FROM `queue` AS `q`, `contact` AS `c`
                        WHERE `c`.`id` = `q`.`cid`
                        ORDER BY `q`.`cid`, `q`.`created`;");
 
-       $t = get_markup_template("admin_queue.tpl");
+       $t = get_markup_template('admin/queue.tpl');
        return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Inspect Queue'),
@@ -608,10 +700,10 @@ function admin_page_queue(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_summary(App $a) {
+function admin_page_summary(App $a)
+{
        // are there MyISAM tables in the DB? If so, trigger a warning message
-       $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1",
-               dbesc(dba::database_name()));
+       $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", dbesc(dba::database_name()));
        $showwarning = false;
        $warningtext = array();
        if (DBM::is_result($r)) {
@@ -620,8 +712,8 @@ function admin_page_summary(App $a) {
        }
        // 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
-       if (Config::get('system', 'check_new_version_url', 'none') != 'none' ) {
-               $gitversion = Config::get('system','git_friendica_version');
+       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);
                        $showwarning = true;
@@ -656,13 +748,13 @@ function admin_page_summary(App $a) {
                array(t('Private Forum Account'), 0)
        );
 
-       $users=0;
+       $users = 0;
        foreach ($r as $u) {
                $accounts[$u['page-flags']][1] = $u['count'];
                $users+= $u['count'];
        }
 
-       logger('accounts: '.print_r($accounts,true),LOGGER_DATA);
+       logger('accounts: ' . print_r($accounts, true), LOGGER_DATA);
 
        $r = q("SELECT COUNT(`id`) AS `count` FROM `register`");
        $pending = $r[0]['count'];
@@ -678,7 +770,7 @@ function admin_page_summary(App $a) {
        $queues = array('label' => t('Message queues'), 'queue' => $queue, 'workerq' => $workerqueue);
 
 
-       $t = get_markup_template("admin_summary.tpl");
+       $t = get_markup_template('admin/summary.tpl');
        return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Summary'),
@@ -690,7 +782,7 @@ function admin_page_summary(App $a) {
                '$baseurl' => System::baseUrl(),
                '$platform' => FRIENDICA_PLATFORM,
                '$codename' => FRIENDICA_CODENAME,
-               '$build' =>  Config::get('system','build'),
+               '$build' => Config::get('system', 'build'),
                '$plugins' => array(t('Active plugins'), $a->plugins),
                '$showwarning' => $showwarning,
                '$warningtext' => $warningtext
@@ -702,7 +794,8 @@ function admin_page_summary(App $a) {
  *
  * @param App $a
  */
-function admin_page_site_post(App $a) {
+function admin_page_site_post(App $a)
+{
        check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
 
        if (!empty($_POST['republish_directory'])) {
@@ -710,17 +803,17 @@ function admin_page_site_post(App $a) {
                return;
        }
 
-       if (!x($_POST,"page_site")) {
+       if (!x($_POST, "page_site")) {
                return;
        }
 
        // relocate
-       if (x($_POST,'relocate') && x($_POST,'relocate_url') && $_POST['relocate_url'] != "") {
+       if (x($_POST, 'relocate') && x($_POST, 'relocate_url') && $_POST['relocate_url'] != "") {
                $new_url = $_POST['relocate_url'];
-               $new_url = rtrim($new_url,"/");
+               $new_url = rtrim($new_url, "/");
 
                $parsed = @parse_url($new_url);
-               if (!$parsed || (!x($parsed,'host') || !x($parsed,'scheme'))) {
+               if (!$parsed || (!x($parsed, 'host') || !x($parsed, 'scheme'))) {
                        notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
                        goaway('admin/site');
                }
@@ -736,7 +829,8 @@ function admin_page_site_post(App $a) {
                $new_host = str_replace("http://", "@", normalise_link($new_url));
                $old_host = str_replace("http://", "@", normalise_link($old_url));
 
-               function update_table($table_name, $fields, $old_url, $new_url) {
+               function update_table($table_name, $fields, $old_url, $new_url)
+               {
                        global $a;
 
                        $dbold = dbesc($old_url);
@@ -754,26 +848,25 @@ function admin_page_site_post(App $a) {
                        $q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
                        $r = q($q);
                        if (!$r) {
-                               notice("Failed updating '$table_name': ".dba::errorMessage());
+                               notice("Failed updating '$table_name': " . dba::errorMessage());
                                goaway('admin/site');
                        }
                }
-
                // update tables
                // update profile links in the format "http://server.tld"
                update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
                update_table("term", array('url'), $old_url, $new_url);
-               update_table("contact", array('photo','thumb','micro','url','nurl','alias','request','notify','poll','confirm','poco', 'avatar'), $old_url, $new_url);
-               update_table("gcontact", array('url','nurl','photo','server_url','notify','alias'), $old_url, $new_url);
-               update_table("item", array('owner-link','owner-avatar','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
+               update_table("contact", array('photo', 'thumb', 'micro', 'url', 'nurl', 'alias', 'request', 'notify', 'poll', 'confirm', 'poco', 'avatar'), $old_url, $new_url);
+               update_table("gcontact", array('url', 'nurl', 'photo', 'server_url', 'notify', 'alias'), $old_url, $new_url);
+               update_table("item", array('owner-link', 'owner-avatar', 'author-link', 'author-avatar', 'body', 'plink', 'tag'), $old_url, $new_url);
 
                // update profile addresses in the format "user@server.tld"
                update_table("contact", array('addr'), $old_host, $new_host);
-               update_table("gcontact", array('connect','addr'), $old_host, $new_host);
+               update_table("gcontact", array('connect', 'addr'), $old_host, $new_host);
 
                // update config
                $a->set_baseurl($new_url);
-               Config::set('system','url',$new_url);
+               Config::set('system', 'url', $new_url);
 
                // send relocate
                $users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
@@ -873,7 +966,7 @@ function admin_page_site_post(App $a) {
        if ($a->get_path() != "") {
                $diaspora_enabled = false;
        }
-       if ($ssl_policy != intval(Config::get('system','ssl_policy'))) {
+       if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
                if ($ssl_policy == SSL_POLICY_FULL) {
                        q("UPDATE `contact` SET
                                `url`     = REPLACE(`url`    , 'http:' , 'https:'),
@@ -912,52 +1005,50 @@ function admin_page_site_post(App $a) {
                        );
                }
        }
-       Config::set('system','ssl_policy',$ssl_policy);
-       Config::set('system','maxloadavg',$maxloadavg);
-       Config::set('system','maxloadavg_frontend',$maxloadavg_frontend);
-       Config::set('system','min_memory',$min_memory);
-       Config::set('system','optimize_max_tablesize',$optimize_max_tablesize);
-       Config::set('system','optimize_fragmentation',$optimize_fragmentation);
-       Config::set('system','poco_completion',$poco_completion);
-       Config::set('system','poco_requery_days',$poco_requery_days);
-       Config::set('system','poco_discovery',$poco_discovery);
-       Config::set('system','poco_discovery_since',$poco_discovery_since);
-       Config::set('system','poco_local_search',$poco_local_search);
-       Config::set('system','nodeinfo',$nodeinfo);
-       Config::set('config','sitename',$sitename);
-       Config::set('config','hostname',$hostname);
-       Config::set('config','sender_email', $sender_email);
-       Config::set('system','suppress_tags',$suppress_tags);
-       Config::set('system','shortcut_icon',$shortcut_icon);
-       Config::set('system','touch_icon',$touch_icon);
+       Config::set('system', 'ssl_policy', $ssl_policy);
+       Config::set('system', 'maxloadavg', $maxloadavg);
+       Config::set('system', 'maxloadavg_frontend', $maxloadavg_frontend);
+       Config::set('system', 'min_memory', $min_memory);
+       Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
+       Config::set('system', 'optimize_fragmentation', $optimize_fragmentation);
+       Config::set('system', 'poco_completion', $poco_completion);
+       Config::set('system', 'poco_requery_days', $poco_requery_days);
+       Config::set('system', 'poco_discovery', $poco_discovery);
+       Config::set('system', 'poco_discovery_since', $poco_discovery_since);
+       Config::set('system', 'poco_local_search', $poco_local_search);
+       Config::set('system', 'nodeinfo', $nodeinfo);
+       Config::set('config', 'sitename', $sitename);
+       Config::set('config', 'hostname', $hostname);
+       Config::set('config', 'sender_email', $sender_email);
+       Config::set('system', 'suppress_tags', $suppress_tags);
+       Config::set('system', 'shortcut_icon', $shortcut_icon);
+       Config::set('system', 'touch_icon', $touch_icon);
 
        if ($banner == "") {
                // don't know why, but del_config doesn't work...
-               q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
-                       dbesc("system"),
-                       dbesc("banner")
+               q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", dbesc("system"), dbesc("banner")
                );
        } else {
-               Config::set('system','banner', $banner);
+               Config::set('system', 'banner', $banner);
        }
 
        if ($info == "") {
-               Config::delete('config','info');
+               Config::delete('config', 'info');
        } else {
-               Config::set('config','info',$info);
+               Config::set('config', 'info', $info);
        }
-       Config::set('system','language', $language);
-       Config::set('system','theme', $theme);
+       Config::set('system', 'language', $language);
+       Config::set('system', 'theme', $theme);
 
        if ($theme_mobile == '---') {
-               Config::delete('system','mobile-theme');
+               Config::delete('system', 'mobile-theme');
        } else {
-               Config::set('system','mobile-theme', $theme_mobile);
+               Config::set('system', 'mobile-theme', $theme_mobile);
        }
        if ($singleuser == '---') {
-               Config::delete('system','singleuser');
+               Config::delete('system', 'singleuser');
        } else {
-               Config::set('system','singleuser', $singleuser);
+               Config::set('system', 'singleuser', $singleuser);
        }
        Config::set('system', 'maximagesize', $maximagesize);
        Config::set('system', 'max_image_length', $maximagelength);
@@ -1023,10 +1114,9 @@ function admin_page_site_post(App $a) {
        Config::set('system', 'frontend_worker', $worker_frontend);
        Config::set('system', 'rino_encrypt', $rino);
 
-       info(t('Site settings updated.').EOL);
+       info(t('Site settings updated.') . EOL);
        goaway('admin/site');
        return; // NOTREACHED
-
 }
 
 /**
@@ -1037,15 +1127,15 @@ function admin_page_site_post(App $a) {
  * @param  App $a
  * @return string
  */
-function admin_page_site(App $a) {
-
+function admin_page_site(App $a)
+{
        /* Installed langs */
        $lang_choices = get_available_languages();
 
-       if (strlen(Config::get('system','directory_submit_url')) &&
-               !strlen(Config::get('system','directory'))) {
-                       Config::set('system','directory', dirname(Config::get('system','directory_submit_url')));
-                       Config::delete('system','directory_submit_url');
+       if (strlen(Config::get('system', 'directory_submit_url')) &&
+               !strlen(Config::get('system', 'directory'))) {
+               Config::set('system', 'directory', dirname(Config::get('system', 'directory_submit_url')));
+               Config::delete('system', 'directory_submit_url');
        }
 
        /* Installed themes */
@@ -1058,8 +1148,9 @@ function admin_page_site(App $a) {
                $allowed_theme_list = Config::get('system', 'allowed_themes');
 
                foreach ($files as $file) {
-                       if (intval(file_exists($file.'/unsupported')))
+                       if (intval(file_exists($file . '/unsupported'))) {
                                continue;
+                       }
 
                        $f = basename($file);
 
@@ -1068,9 +1159,9 @@ function admin_page_site(App $a) {
                                continue;
                        }
 
-                       $theme_name = ((file_exists($file.'/experimental')) ?  sprintf("%s - \x28Experimental\x29", $f) : $f);
+                       $theme_name = ((file_exists($file . '/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
 
-                       if (file_exists($file.'/mobile')) {
+                       if (file_exists($file . '/mobile')) {
                                $theme_choices_mobile[$f] = $theme_name;
                        } else {
                                $theme_choices[$f] = $theme_name;
@@ -1083,7 +1174,7 @@ function admin_page_site(App $a) {
                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")
-               );
+       );
 
        /* OStatus conversation poll choices */
        $ostatus_poll_choices = array(
@@ -1093,21 +1184,21 @@ function admin_page_site(App $a) {
                "60" => t("Hourly"),
                "720" => t("Twice daily"),
                "1440" => t("Daily")
-               );
+       );
 
        $poco_discovery_choices = array(
                "0" => t("Disabled"),
                "1" => t("Users"),
                "2" => t("Users, Global Contacts"),
                "3" => t("Users, Global Contacts/fallback"),
-               );
+       );
 
        $poco_discovery_since_choices = array(
                "30" => t("One month"),
                "91" => t("Three months"),
                "182" => t("Half a year"),
                "365" => t("One year"),
-               );
+       );
 
        /* get user names to make the install a personal install of X */
        $user_names = array();
@@ -1118,12 +1209,12 @@ function admin_page_site(App $a) {
        }
 
        /* Banner */
-       $banner = Config::get('system','banner');
+       $banner = Config::get('system', 'banner');
        if ($banner == false) {
                $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
        }
        $banner = htmlspecialchars($banner);
-       $info = Config::get('config','info');
+       $info = Config::get('config', 'info');
        $info = htmlspecialchars($info);
 
        // Automatically create temporary paths
@@ -1156,7 +1247,7 @@ function admin_page_site(App $a) {
        }
        $diaspora_able = ($a->get_path() == "");
 
-       $optimize_max_tablesize = Config::get('system','optimize_max_tablesize', 100);
+       $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', 100);
 
        if ($optimize_max_tablesize < -1) {
                $optimize_max_tablesize = -1;
@@ -1166,7 +1257,7 @@ function admin_page_site(App $a) {
                $optimize_max_tablesize = 100;
        }
 
-       $t = get_markup_template("admin_site.tpl");
+       $t = get_markup_template('admin/site.tpl');
        return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Site'),
@@ -1179,7 +1270,7 @@ function admin_page_site(App $a) {
                '$portable_contacts' => t('Auto Discovered Contact Directory'),
                '$performance' => t('Performance'),
                '$worker_title' => t('Worker'),
-               '$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
+               '$relocate' => t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
                '$baseurl' => System::baseUrl(true),
                // name, label, value, help string, extra data...
                '$sitename'             => array('sitename', t("Site name"), $a->config['sitename'],''),
@@ -1188,7 +1279,7 @@ function admin_page_site(App $a) {
                '$banner'               => array('banner', t("Banner/Logo"), $banner, ""),
                '$shortcut_icon'        => array('shortcut_icon', t("Shortcut icon"), Config::get('system','shortcut_icon'),  t("Link to an icon that will be used for browsers.")),
                '$touch_icon'           => array('touch_icon', t("Touch icon"), Config::get('system','touch_icon'),  t("Link to an icon that will be used for tablets and mobiles.")),
-               '$info'                 => array('info', t('Additional Info'), $info, sprintf(t('For public servers: you can add additional information here that will be listed at %s/siteinfo.'), get_server())),
+               '$info'                 => array('info', t('Additional Info'), $info, sprintf(t('For public servers: you can add additional information here that will be listed at %s/servers.'), get_server())),
                '$language'             => array('language', t("System language"), Config::get('system','language'), "", $lang_choices),
                '$theme'                => array('theme', t("System theme"), Config::get('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
                '$theme_mobile'         => array('theme_mobile', t("Mobile system theme"), Config::get('system', 'mobile-theme', '---'), t("Theme for mobile devices"), $theme_choices_mobile),
@@ -1264,9 +1355,7 @@ function admin_page_site(App $a) {
                '$worker_frontend'      => array('worker_frontend', t('Enable frontend worker'), Config::get('system','frontend_worker'), sprintf(t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.'), System::baseUrl())),
 
                '$form_security_token'  => get_form_security_token("admin_site")
-
        ));
-
 }
 
 /**
@@ -1280,18 +1369,18 @@ function admin_page_site(App $a) {
  *
  * @param App $a
  * @return string
- **/
-function admin_page_dbsync(App $a) {
-
+ * */
+function admin_page_dbsync(App $a)
+{
        $o = '';
 
        if ($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') {
-               Config::set('database', 'update_'.intval($a->argv[3]), 'success');
-               $curr = Config::get('system','build');
+               Config::set('database', 'update_' . intval($a->argv[3]), 'success');
+               $curr = Config::get('system', 'build');
                if (intval($curr) == intval($a->argv[3])) {
-                       Config::set('system','build',intval($curr) + 1);
+                       Config::set('system', 'build', intval($curr) + 1);
                }
-               info(t('Update has been marked successful').EOL);
+               info(t('Update has been marked successful') . EOL);
                goaway('admin/dbsync');
        }
 
@@ -1299,11 +1388,10 @@ function admin_page_dbsync(App $a) {
                require_once("include/dbstructure.php");
                $retval = update_structure(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');
+                       $o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION) . "<br />";
+                       Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
                } else {
-                       $o .= sprintf(t("Executing of database structure update %s failed with error: %s"),
-                                       DB_UPDATE_VERSION, $retval)."<br />";
+                       $o .= sprintf(t("Executing of database structure update %s failed with error: %s"), DB_UPDATE_VERSION, $retval) . "<br />";
                }
                if ($a->argv[2] === 'check') {
                        return $o;
@@ -1311,22 +1399,21 @@ function admin_page_dbsync(App $a) {
        }
 
        if ($a->argc > 2 && intval($a->argv[2])) {
-               require_once('update.php');
-               $func = 'update_'.intval($a->argv[2]);
+               require_once 'update.php';
+               $func = 'update_' . intval($a->argv[2]);
                if (function_exists($func)) {
                        $retval = $func();
                        if ($retval === UPDATE_FAILED) {
                                $o .= sprintf(t("Executing %s failed with error: %s"), $func, $retval);
-                       }
-                       elseif ($retval === UPDATE_SUCCESS) {
+                       } elseif ($retval === UPDATE_SUCCESS) {
                                $o .= sprintf(t('Update %s was successfully applied.', $func));
-                               Config::set('database',$func, 'success');
+                               Config::set('database', $func, 'success');
                        } else {
                                $o .= sprintf(t('Update %s did not return a status. Unknown if it succeeded.'), $func);
                        }
                } else {
-                       $o .= sprintf(t('There was no additional update function %s that needed to be called.'), $func)."<br />";
-                       Config::set('database',$func, 'success');
+                       $o .= sprintf(t('There was no additional update function %s that needed to be called.'), $func) . "<br />";
+                       Config::set('database', $func, 'success');
                }
                return $o;
        }
@@ -1335,32 +1422,31 @@ function admin_page_dbsync(App $a) {
        $r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' ");
        if (DBM::is_result($r)) {
                foreach ($r as $rr) {
-                       $upd = intval(substr($rr['k'],7));
+                       $upd = intval(substr($rr['k'], 7));
                        if ($upd < 1139 || $rr['v'] === 'success') {
                                continue;
                        }
                        $failed[] = $upd;
                }
        }
-       if (! count($failed)) {
-               $o = replace_macros(get_markup_template('structure_check.tpl'),array(
-                       '$base'   => System::baseUrl(true),
+       if (!count($failed)) {
+               $o = replace_macros(get_markup_template('structure_check.tpl'), array(
+                       '$base' => System::baseUrl(true),
                        '$banner' => t('No failed updates.'),
-                       '$check'  => t('Check database structure'),
+                       '$check' => t('Check database structure'),
                ));
        } else {
-               $o = replace_macros(get_markup_template('failed_updates.tpl'),array(
-                       '$base'   => System::baseUrl(true),
+               $o = replace_macros(get_markup_template('failed_updates.tpl'), array(
+                       '$base' => System::baseUrl(true),
                        '$banner' => t('Failed Updates'),
-                       '$desc'   => t('This does not include updates prior to 1139, which did not return a status.'),
-                       '$mark'   => t('Mark success (if update was manually applied)'),
-                       '$apply'  => t('Attempt to execute this update step automatically'),
+                       '$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
+                       '$mark' => t('Mark success (if update was manually applied)'),
+                       '$apply' => t('Attempt to execute this update step automatically'),
                        '$failed' => $failed
                ));
        }
 
        return $o;
-
 }
 
 /**
@@ -1368,7 +1454,8 @@ function admin_page_dbsync(App $a) {
  *
  * @param App $a
  */
-function admin_page_users_post(App $a) {
+function admin_page_users_post(App $a)
+{
        $pending     = (x($_POST, 'pending')           ? $_POST['pending']           : array());
        $users       = (x($_POST, 'user')              ? $_POST['user']               : array());
        $nu_name     = (x($_POST, 'new_user_name')     ? $_POST['new_user_name']     : '');
@@ -1379,11 +1466,9 @@ function admin_page_users_post(App $a) {
        check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
 
        if (!($nu_name === "") && !($nu_email === "") && !($nu_nickname === "")) {
-               require_once('include/user.php');
-
-               $result = create_user(array('username'=>$nu_name, 'email'=>$nu_email,
-                       'nickname'=>$nu_nickname, 'verified'=>1, 'language'=>$nu_language));
-               if (! $result['success']) {
+               $result = User::create(array('username' => $nu_name, 'email' => $nu_email,
+                       'nickname' => $nu_nickname, 'verified' => 1, 'language' => $nu_language));
+               if (!$result['success']) {
                        notice($result['message']);
                        return;
                }
@@ -1423,34 +1508,32 @@ function admin_page_users_post(App $a) {
                notification(array(
                        'type' => SYSTEM_EMAIL,
                        'to_email' => $nu['email'],
-                       'subject'=> sprintf(t('Registration details for %s'), $a->config['sitename']),
-                       'preamble'=> $preamble,
+                       'subject' => sprintf(t('Registration details for %s'), $a->config['sitename']),
+                       'preamble' => $preamble,
                        'body' => $body));
-
        }
 
-       if (x($_POST,'page_users_block')) {
+       if (x($_POST, 'page_users_block')) {
                foreach ($users as $uid) {
-                       q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s",
-                               intval($uid)
+                       q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s", intval($uid)
                        );
                }
                notice(sprintf(tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)), count($users)));
        }
-       if (x($_POST,'page_users_delete')) {
+       if (x($_POST, 'page_users_delete')) {
                foreach ($users as $uid) {
                        User::remove($uid);
                }
                notice(sprintf(tt("%s user deleted", "%s users deleted", count($users)), count($users)));
        }
 
-       if (x($_POST,'page_users_approve')) {
+       if (x($_POST, 'page_users_approve')) {
                require_once("mod/regmod.php");
                foreach ($pending as $hash) {
                        user_allow($hash);
                }
        }
-       if (x($_POST,'page_users_deny')) {
+       if (x($_POST, 'page_users_deny')) {
                require_once("mod/regmod.php");
                foreach ($pending as $hash) {
                        user_deny($hash);
@@ -1472,35 +1555,33 @@ function admin_page_users_post(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_users(App $a) {
-       if ($a->argc>2) {
+function admin_page_users(App $a)
+{
+       if ($a->argc > 2) {
                $uid = $a->argv[3];
                $user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
                if (count($user) == 0) {
-                       notice('User not found'.EOL);
+                       notice('User not found' . EOL);
                        goaway('admin/users');
                        return ''; // NOTREACHED
                }
-               switch($a->argv[2]) {
+               switch ($a->argv[2]) {
                        case "delete":
                                check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
                                // delete user
                                User::remove($uid);
 
-                               notice(sprintf(t("User '%s' deleted"), $user[0]['username']).EOL);
+                               notice(sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL);
                                break;
                        case "block":
                                check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
-                               q("UPDATE `user` SET `blocked` = %d WHERE `uid` = %s",
-                                       intval(1-$user[0]['blocked']),
-                                       intval($uid)
+                               q("UPDATE `user` SET `blocked` = %d WHERE `uid` = %s", intval(1 - $user[0]['blocked']), intval($uid)
                                );
-                               notice(sprintf(($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']).EOL);
+                               notice(sprintf(($user[0]['blocked'] ? t("User '%s' unblocked") : t("User '%s' blocked")), $user[0]['username']) . EOL);
                                break;
                }
                goaway('admin/users');
                return ''; // NOTREACHED
-
        }
 
        /* get pending */
@@ -1529,31 +1610,29 @@ function admin_page_users(App $a) {
 
        $order = "contact.name";
        $order_direction = "+";
-       if (x($_GET,'o')) {
+       if (x($_GET, 'o')) {
                $new_order = $_GET['o'];
                if ($new_order[0] === "-") {
                        $order_direction = "-";
-                       $new_order = substr($new_order,1);
+                       $new_order = substr($new_order, 1);
                }
 
                if (in_array($new_order, $valid_orders)) {
                        $order = $new_order;
                }
-               if (x($_GET,'d')) {
+               if (x($_GET, 'd')) {
                        $new_direction = $_GET['d'];
                }
        }
-       $sql_order = "`".str_replace('.','`.`',$order)."`";
-       $sql_order_direction = ($order_direction === "+")?"ASC":"DESC";
+       $sql_order = "`" . str_replace('.', '`.`', $order) . "`";
+       $sql_order_direction = ($order_direction === "+") ? "ASC" : "DESC";
 
        $users = q("SELECT `user`.*, `contact`.`name`, `contact`.`url`, `contact`.`micro`, `user`.`account_expired`, `contact`.`last-item` AS `lastitem_date`
                                FROM `user`
                                INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
                                WHERE `user`.`verified`
-                               ORDER BY $sql_order $sql_order_direction LIMIT %d, %d",
-                               intval($a->pager['start']),
-                               intval($a->pager['itemspage'])
-                               );
+                               ORDER BY $sql_order $sql_order_direction LIMIT %d, %d", intval($a->pager['start']), intval($a->pager['itemspage'])
+       );
 
        //echo "<pre>$users"; killme();
 
@@ -1563,7 +1642,7 @@ function admin_page_users(App $a) {
                        t('Normal Account'),
                        t('Automatic Follower Account'),
                        t('Public Forum Account'),
-                                               t('Automatic Friend Account')
+                       t('Automatic Friend Account')
                );
                $e['page-flags'] = $accounts[$e['page-flags']];
                $e['register_date'] = relative_date($e['register_date']);
@@ -1572,7 +1651,7 @@ function admin_page_users(App $a) {
                //$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'] ? relative_date($e['account_expires_on']) : False);
                return $e;
        };
        $users = array_map($_setup_users, $users);
@@ -1587,7 +1666,7 @@ function admin_page_users(App $a) {
        while (count($users)) {
                $new_user = array();
                foreach (array_pop($users) as $k => $v) {
-                       $k = str_replace('-','_',$k);
+                       $k = str_replace('-', '_', $k);
                        $new_user[$k] = $v;
                }
                if ($new_user['deleted']) {
@@ -1602,12 +1681,10 @@ function admin_page_users(App $a) {
                array_push($users, array_pop($tmp_users));
        }
 
-       $th_users = array_map(null,
-               array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'),  t('Account')),
-               $valid_orders
+       $th_users = array_map(null, array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')), $valid_orders
        );
 
-       $t = get_markup_template("admin_users.tpl");
+       $t = get_markup_template('admin/users.tpl');
        $o = replace_macros($t, array(
                // strings //
                '$title' => t('Administration'),
@@ -1617,7 +1694,7 @@ function admin_page_users(App $a) {
                '$h_pending' => t('User registrations waiting for confirm'),
                '$h_deleted' => t('User waiting for permanent deletion'),
                '$th_pending' => array(t('Request date'), t('Name'), t('Email')),
-               '$no_pending' =>  t('No registrations.'),
+               '$no_pending' => t('No registrations.'),
                '$pendingnotetext' => t('Note from the user'),
                '$approve' => t('Approve'),
                '$deny' => t('Deny'),
@@ -1653,7 +1730,6 @@ function admin_page_users(App $a) {
        return $o;
 }
 
-
 /**
  * @brief Plugins admin page
  *
@@ -1670,8 +1746,8 @@ function admin_page_users(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_plugins(App $a) {
-
+function admin_page_plugins(App $a)
+{
        /*
         * Single plugin
         */
@@ -1682,7 +1758,7 @@ function admin_page_plugins(App $a) {
                        return '';
                }
 
-               if (x($_GET,"a") && $_GET['a']=="t") {
+               if (x($_GET, "a") && $_GET['a'] == "t") {
                        check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
 
                        // Toggle plugin status
@@ -1696,7 +1772,7 @@ function admin_page_plugins(App $a) {
                                install_plugin($plugin);
                                info(sprintf(t("Plugin %s enabled."), $plugin));
                        }
-                       Config::set("system","addon", implode(", ",$a->plugins));
+                       Config::set("system", "addon", implode(", ", $a->plugins));
                        goaway('admin/plugins');
                        return ''; // NOTREACHED
                }
@@ -1705,27 +1781,29 @@ function admin_page_plugins(App $a) {
                require_once('library/markdown.php');
 
                if (in_array($plugin, $a->plugins)) {
-                       $status="on"; $action= t("Disable");
+                       $status = "on";
+                       $action = t("Disable");
                } else {
-                       $status="off"; $action= t("Enable");
+                       $status = "off";
+                       $action = t("Enable");
                }
 
-               $readme=Null;
+               $readme = Null;
                if (is_file("addon/$plugin/README.md")) {
                        $readme = file_get_contents("addon/$plugin/README.md");
                        $readme = Markdown($readme, false);
                } elseif (is_file("addon/$plugin/README")) {
-                       $readme = "<pre>". file_get_contents("addon/$plugin/README") ."</pre>";
+                       $readme = "<pre>" . file_get_contents("addon/$plugin/README") . "</pre>";
                }
 
-               $admin_form="";
+               $admin_form = "";
                if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)) {
                        @require_once("addon/$plugin/$plugin.php");
-                       $func = $plugin.'_plugin_admin';
+                       $func = $plugin . '_plugin_admin';
                        $func($a, $admin_form);
                }
 
-               $t = get_markup_template("admin_plugins_details.tpl");
+               $t = get_markup_template('admin/plugins_details.tpl');
 
                return replace_macros($t, array(
                        '$title' => t('Administration'),
@@ -1750,17 +1828,14 @@ function admin_page_plugins(App $a) {
                ));
        }
 
-
-
        /*
         * List plugins
         */
-
-       if (x($_GET,"a") && $_GET['a']=="r") {
-               check_form_security_token_redirectOnErr(System::baseUrl().'/admin/plugins', 'admin_themes', 't');
+       if (x($_GET, "a") && $_GET['a'] == "r") {
+               check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/plugins', 'admin_themes', 't');
                reload_plugins();
                info("Plugins reloaded");
-               goaway(System::baseUrl().'/admin/plugins');
+               goaway(System::baseUrl() . '/admin/plugins');
        }
 
        $plugins = array();
@@ -1768,12 +1843,12 @@ function admin_page_plugins(App $a) {
        if ($files) {
                foreach ($files as $file) {
                        if (is_dir($file)) {
-                               list($tmp, $id)=array_map("trim", explode("/",$file));
+                               list($tmp, $id) = array_map("trim", explode("/", $file));
                                $info = get_plugin_info($id);
                                $show_plugin = true;
 
                                // If the addon is unsupported, then only show it, when it is enabled
-                               if ((strtolower($info["status"]) == "unsupported") && !in_array($id,  $a->plugins)) {
+                               if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->plugins)) {
                                        $show_plugin = false;
                                }
 
@@ -1783,13 +1858,13 @@ function admin_page_plugins(App $a) {
                                }
 
                                if ($show_plugin) {
-                                       $plugins[] = array($id, (in_array($id,  $a->plugins)?"on":"off") , $info);
+                                       $plugins[] = array($id, (in_array($id, $a->plugins) ? "on" : "off"), $info);
                                }
                        }
                }
        }
 
-       $t = get_markup_template("admin_plugins.tpl");
+       $t = get_markup_template('admin/plugins.tpl');
        return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Plugins'),
@@ -1809,14 +1884,14 @@ function admin_page_plugins(App $a) {
  * @param string $th
  * @param int $result
  */
-function toggle_theme(&$themes,$th,&$result) {
-       for($x = 0; $x < count($themes); $x ++) {
+function toggle_theme(&$themes, $th, &$result)
+{
+       for ($x = 0; $x < count($themes); $x ++) {
                if ($themes[$x]['name'] === $th) {
                        if ($themes[$x]['allowed']) {
                                $themes[$x]['allowed'] = 0;
                                $result = 0;
-                       }
-                       else {
+                       } else {
                                $themes[$x]['allowed'] = 1;
                                $result = 1;
                        }
@@ -1829,13 +1904,13 @@ function toggle_theme(&$themes,$th,&$result) {
  * @param string $th
  * @return int
  */
-function theme_status($themes,$th) {
-       for($x = 0; $x < count($themes); $x ++) {
+function theme_status($themes, $th)
+{
+       for ($x = 0; $x < count($themes); $x ++) {
                if ($themes[$x]['name'] === $th) {
                        if ($themes[$x]['allowed']) {
                                return 1;
-                       }
-                       else {
+                       } else {
                                return 0;
                        }
                }
@@ -1843,12 +1918,12 @@ function theme_status($themes,$th) {
        return 0;
 }
 
-
 /**
  * @param array $themes
  * @return string
  */
-function rebuild_theme_table($themes) {
+function rebuild_theme_table($themes)
+{
        $o = '';
        if (count($themes)) {
                foreach ($themes as $th) {
@@ -1863,7 +1938,6 @@ function rebuild_theme_table($themes) {
        return $o;
 }
 
-
 /**
  * @brief Themes admin page
  *
@@ -1880,10 +1954,10 @@ function rebuild_theme_table($themes) {
  * @param App $a
  * @return string
  */
-function admin_page_themes(App $a) {
-
-       $allowed_themes_str = Config::get('system','allowed_themes');
-       $allowed_themes_raw = explode(',',$allowed_themes_str);
+function admin_page_themes(App $a)
+{
+       $allowed_themes_str = Config::get('system', 'allowed_themes');
+       $allowed_themes_raw = explode(',', $allowed_themes_str);
        $allowed_themes = array();
        if (count($allowed_themes_raw)) {
                foreach ($allowed_themes_raw as $x) {
@@ -1900,16 +1974,16 @@ function admin_page_themes(App $a) {
                        $f = basename($file);
 
                        // Is there a style file?
-                       $theme_files = glob('view/theme/'.$f.'/style.*');
+                       $theme_files = glob('view/theme/' . $f . '/style.*');
 
                        // If not then quit
                        if (count($theme_files) == 0) {
                                continue;
                        }
 
-                       $is_experimental = intval(file_exists($file.'/experimental'));
-                       $is_supported = 1-(intval(file_exists($file.'/unsupported')));
-                       $is_allowed = intval(in_array($f,$allowed_themes));
+                       $is_experimental = intval(file_exists($file . '/experimental'));
+                       $is_supported = 1 - (intval(file_exists($file . '/unsupported')));
+                       $is_allowed = intval(in_array($f, $allowed_themes));
 
                        if ($is_allowed || $is_supported || Config::get("system", "show_unsupported_themes")) {
                                $themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
@@ -1917,7 +1991,7 @@ function admin_page_themes(App $a) {
                }
        }
 
-       if (! count($themes)) {
+       if (!count($themes)) {
                notice(t('No themes found.'));
                return '';
        }
@@ -1928,38 +2002,40 @@ function admin_page_themes(App $a) {
 
        if ($a->argc == 3) {
                $theme = $a->argv[2];
-               if (! is_dir("view/theme/$theme")) {
+               if (!is_dir("view/theme/$theme")) {
                        notice(t("Item not found."));
                        return '';
                }
 
-               if (x($_GET,"a") && $_GET['a']=="t") {
+               if (x($_GET, "a") && $_GET['a'] == "t") {
                        check_form_security_token_redirectOnErr('/admin/themes', 'admin_themes', 't');
 
                        // Toggle theme status
 
-                       toggle_theme($themes,$theme,$result);
+                       toggle_theme($themes, $theme, $result);
                        $s = rebuild_theme_table($themes);
                        if ($result) {
                                install_theme($theme);
-                               info(sprintf('Theme %s enabled.',$theme));
+                               info(sprintf('Theme %s enabled.', $theme));
                        } else {
                                uninstall_theme($theme);
-                               info(sprintf('Theme %s disabled.',$theme));
+                               info(sprintf('Theme %s disabled.', $theme));
                        }
 
-                       Config::set('system','allowed_themes',$s);
+                       Config::set('system', 'allowed_themes', $s);
                        goaway('admin/themes');
                        return ''; // NOTREACHED
                }
 
                // display theme details
-               require_once('library/markdown.php');
+               require_once 'library/markdown.php';
 
-               if (theme_status($themes,$theme)) {
-                       $status="on"; $action= t("Disable");
+               if (theme_status($themes, $theme)) {
+                       $status = "on";
+                       $action = t("Disable");
                } else {
-                       $status="off"; $action= t("Enable");
+                       $status = "off";
+                       $action = t("Enable");
                }
 
                $readme = Null;
@@ -1967,12 +2043,14 @@ function admin_page_themes(App $a) {
                        $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>";
+                       $readme = "<pre>" . file_get_contents("view/theme/$theme/README") . "</pre>";
                }
 
                $admin_form = "";
                if (is_file("view/theme/$theme/config.php")) {
-                       function __get_theme_admin_form(App $a, $theme) {
+
+                       function __get_theme_admin_form(App $a, $theme)
+                       {
                                $orig_theme = $a->theme;
                                $orig_page = $a->page;
                                $orig_session_theme = $_SESSION['theme'];
@@ -1981,7 +2059,7 @@ function admin_page_themes(App $a) {
                                $_SESSION['theme'] = $theme;
 
 
-                               $init = $theme."_init";
+                               $init = $theme . "_init";
                                if (function_exists($init)) {
                                        $init($a);
                                }
@@ -1998,11 +2076,11 @@ function admin_page_themes(App $a) {
                }
 
                $screenshot = array(get_theme_screenshot($theme), t('Screenshot'));
-               if (! stristr($screenshot[0],$theme)) {
+               if (!stristr($screenshot[0], $theme)) {
                        $screenshot = null;
                }
 
-               $t = get_markup_template("admin_plugins_details.tpl");
+               $t = get_markup_template('admin/plugins_details.tpl');
                return replace_macros($t, array(
                        '$title' => t('Administration'),
                        '$page' => t('Themes'),
@@ -2026,8 +2104,8 @@ function admin_page_themes(App $a) {
 
 
        // reload active themes
-       if (x($_GET,"a") && $_GET['a']=="r") {
-               check_form_security_token_redirectOnErr(System::baseUrl().'/admin/themes', 'admin_themes', 't');
+       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']) {
@@ -2037,7 +2115,7 @@ function admin_page_themes(App $a) {
                        }
                }
                info("Themes reloaded");
-               goaway(System::baseUrl().'/admin/themes');
+               goaway(System::baseUrl() . '/admin/themes');
        }
 
        /*
@@ -2047,12 +2125,11 @@ function admin_page_themes(App $a) {
        $xthemes = array();
        if ($themes) {
                foreach ($themes as $th) {
-                       $xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
+                       $xthemes[] = array($th['name'], (($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
                }
        }
 
-
-       $t = get_markup_template("admin_plugins.tpl");
+       $t = get_markup_template('admin/plugins.tpl');
        return replace_macros($t, array(
                '$title'               => t('Administration'),
                '$page'                => t('Themes'),
@@ -2069,23 +2146,23 @@ function admin_page_themes(App $a) {
        ));
 }
 
-
 /**
  * @brief Prosesses data send by Logs admin page
  *
  * @param App $a
  */
-function admin_page_logs_post(App $a) {
-       if (x($_POST,"page_logs")) {
+function admin_page_logs_post(App $a)
+{
+       if (x($_POST, "page_logs")) {
                check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
 
                $logfile   = ((x($_POST,'logfile'))   ? notags(trim($_POST['logfile']))  : '');
                $debugging = ((x($_POST,'debugging')) ? true                             : false);
                $loglevel  = ((x($_POST,'loglevel'))  ? intval(trim($_POST['loglevel'])) : 0);
 
-               Config::set('system','logfile', $logfile);
-               Config::set('system','debugging',  $debugging);
-               Config::set('system','loglevel', $loglevel);
+               Config::set('system', 'logfile', $logfile);
+               Config::set('system', 'debugging', $debugging);
+               Config::set('system', 'loglevel', $loglevel);
        }
 
        info(t("Log settings updated."));
@@ -2109,8 +2186,8 @@ function admin_page_logs_post(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_logs(App $a) {
-
+function admin_page_logs(App $a)
+{
        $log_choices = array(
                LOGGER_NORMAL   => 'Normal',
                LOGGER_TRACE    => 'Trace',
@@ -2125,7 +2202,7 @@ function admin_page_logs(App $a) {
                $phplogenabled = t('PHP log currently disabled.');
        }
 
-       $t = get_markup_template("admin_logs.tpl");
+       $t = get_markup_template('admin/logs.tpl');
 
        return replace_macros($t, array(
                '$title' => t('Administration'),
@@ -2133,13 +2210,11 @@ function admin_page_logs(App $a) {
                '$submit' => t('Save Settings'),
                '$clear' => t('Clear'),
                '$baseurl' => System::baseUrl(true),
-               '$logname' =>  Config::get('system','logfile'),
-
+               '$logname' => Config::get('system', 'logfile'),
                // name, label, value, help string, extra data...
-               '$debugging' => array('debugging', t("Enable Debugging"),Config::get('system','debugging'), ""),
-               '$logfile' => array('logfile', t("Log file"), Config::get('system','logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
-               '$loglevel' => array('loglevel', t("Log level"), Config::get('system','loglevel'), "", $log_choices),
-
+               '$debugging' => array('debugging', t("Enable Debugging"), Config::get('system', 'debugging'), ""),
+               '$logfile' => array('logfile', t("Log file"), Config::get('system', 'logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
+               '$loglevel' => array('loglevel', t("Log level"), Config::get('system', 'loglevel'), "", $log_choices),
                '$form_security_token' => get_form_security_token("admin_logs"),
                '$phpheader' => t("PHP logging"),
                '$phphint' => t("To enable logging of PHP errors and warnings you can add the following to the .htconfig.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
@@ -2166,9 +2241,10 @@ function admin_page_logs(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_viewlogs(App $a) {
-       $t = get_markup_template("admin_viewlogs.tpl");
-       $f = Config::get('system','logfile');
+function admin_page_viewlogs(App $a)
+{
+       $t = get_markup_template('admin/viewlogs.tpl');
+       $f = Config::get('system', 'logfile');
        $data = '';
 
        if (!file_exists($f)) {
@@ -2184,11 +2260,11 @@ function admin_page_viewlogs(App $a) {
                                if ($size > 5000000 || $size < 0) {
                                        $size = 5000000;
                                }
-                               $seek = fseek($fp,0-$size,SEEK_END);
+                               $seek = fseek($fp, 0 - $size, SEEK_END);
                                if ($seek === 0) {
-                                       $data = escape_tags(fread($fp,$size));
-                                       while (! feof($fp)) {
-                                               $data .= escape_tags(fread($fp,4096));
+                                       $data = escape_tags(fread($fp, $size));
+                                       while (!feof($fp)) {
+                                               $data .= escape_tags(fread($fp, 4096));
                                        }
                                }
                        }
@@ -2199,7 +2275,7 @@ function admin_page_viewlogs(App $a) {
                '$title' => t('Administration'),
                '$page' => t('View Logs'),
                '$data' => $data,
-               '$logname' =>  Config::get('system','logfile')
+               '$logname' => Config::get('system', 'logfile')
        ));
 }
 
@@ -2208,14 +2284,14 @@ function admin_page_viewlogs(App $a) {
  *
  * @param App $a
  */
-function admin_page_features_post(App $a) {
-
+function admin_page_features_post(App $a)
+{
        check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
 
-       logger('postvars: '.print_r($_POST,true),LOGGER_DATA);
+       logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
 
        $arr = array();
-       $features = get_features(false);
+       $features = Feature::get(false);
 
        foreach ($features as $fname => $fdata) {
                foreach (array_slice($fdata, 1) as $f) {
@@ -2256,26 +2332,25 @@ function admin_page_features_post(App $a) {
  * @param App $a
  * @return string
  */
-function admin_page_features(App $a) {
-
+function admin_page_features(App $a)
+{
        if ((argc() > 1) && (argv(1) === 'features')) {
                $arr = array();
-               $features = get_features(false);
+               $features = Feature::get(false);
 
                foreach ($features as $fname => $fdata) {
                        $arr[$fname] = array();
                        $arr[$fname][0] = $fdata[0];
-                       foreach (array_slice($fdata,1) as $f) {
-
+                       foreach (array_slice($fdata, 1) as $f) {
                                $set = Config::get('feature', $f[0], $f[3]);
                                $arr[$fname][1][] = array(
-                                       array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'), t('On'))),
-                                       array('featurelock_' .$f[0],sprintf(t('Lock feature %s'),$f[1]),(($f[4] !== false) ? "1" : ''),'',array(t('Off'), t('On')))
+                                       array('feature_' . $f[0], $f[1], $set, $f[2], array(t('Off'), t('On'))),
+                                       array('featurelock_' . $f[0], sprintf(t('Lock feature %s'), $f[1]), (($f[4] !== false) ? "1" : ''), '', array(t('Off'), t('On')))
                                );
                        }
                }
 
-               $tpl = get_markup_template("admin_settings_features.tpl");
+               $tpl = get_markup_template('admin/settings_features.tpl');
                $o .= replace_macros($tpl, array(
                        '$form_security_token' => get_form_security_token("admin_manage_features"),
                        '$title' => t('Manage Additional Features'),
index 170e7ea4c2f44dc55a8383f037b41280bdd1a4be..7eb31905b8ee80fb773dd26c6540bf8b971c03b3 100644 (file)
@@ -5,8 +5,8 @@
  *     This calendar is for profile visitors and contains only the events
  *     of the profile owner
  */
-
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -301,7 +301,7 @@ function cal_content(App $a) {
 
                // Test permissions
                // Respect the export feature setting for all other /cal pages if it's not the own profile
-               if( ((local_user() !== intval($owner_uid))) && ! feature_enabled($owner_uid, "export_calendar")) {
+               if( ((local_user() !== intval($owner_uid))) && ! Feature::isEnabled($owner_uid, "export_calendar")) {
                        notice( t('Permission denied.') . EOL);
                        goaway('cal/' . $nick);
                }
index 69f1884960145776dae8ef104ce0c2490ef69c0e..9feacaf5e38f2e2044f0fdd3aa06f4ed24f8b510 100644 (file)
@@ -559,7 +559,7 @@ function contacts_content(App $a) {
                }
                $lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
 
-               $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2));
+               $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL));
 
                $nettype = sprintf( t('Network type: %s'),network_to_name($contact['network'], $contact["url"]));
 
@@ -586,7 +586,7 @@ function contacts_content(App $a) {
                                                                        '3' => t('Fetch keywords'),
                                                                        '2' => t('Fetch information and keywords')));
                }
-               if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)))
+               if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL)))
                        $poll_interval = contact_poll_interval($contact['priority'],(! $poll_enabled));
 
                if ($contact['network'] == NETWORK_DFRN)
@@ -994,7 +994,7 @@ function _contact_detail_for_template($rr){
  */
 function contact_actions($contact) {
 
-       $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2));
+       $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL));
        $contact_action = array();
 
        // Provide friend suggestion only for Friendica contacts
index 3c7584318690b8f62d432010221ac9c252a2d961..67395a9fcc714abb740ab9eecf15e1ac5177d278 100644 (file)
@@ -292,15 +292,12 @@ function dfrn_request_post(App $a) {
                 *
                 * Cleanup old introductions that remain blocked.
                 * Also remove the contact record, but only if there is no existing relationship
-                * Do not remove email contacts as these may be awaiting email verification
                 */
 
                $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
                        FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
                        WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
-                       AND `contact`.`network` != '%s'
-                       AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
-                       dbesc(NETWORK_MAIL2)
+                       AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE "
                );
                if (DBM::is_result($r)) {
                        foreach ($r as $rr) {
@@ -315,32 +312,6 @@ function dfrn_request_post(App $a) {
                        }
                }
 
-               /*
-                *
-                * Cleanup any old email intros - which will have a greater lifetime
-                */
-
-               $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
-                       FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
-                       WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
-                       AND `contact`.`network` = '%s'
-                       AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
-                       dbesc(NETWORK_MAIL2)
-               );
-               if (DBM::is_result($r)) {
-                       foreach ($r as $rr) {
-                               if(! $rr['rel']) {
-                                       q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
-                                               intval($rr['cid'])
-                                       );
-                               }
-                               q("DELETE FROM `intro` WHERE `id` = %d",
-                                       intval($rr['iid'])
-                               );
-                       }
-               }
-
-               $email_follow = (x($_POST,'email_follow') ? intval($_POST['email_follow']) : 0);
                $real_name = (x($_POST,'realname') ? notags(trim($_POST['realname'])) : '');
 
                $url = trim($_POST['dfrn_url']);
@@ -351,125 +322,25 @@ function dfrn_request_post(App $a) {
 
                $hcard = '';
 
-               if($email_follow) {
+               // Detect the network
+               $data = Probe::uri($url);
+               $network = $data["network"];
 
-                       if(! validate_email($url)) {
-                               notice( t('Invalid email address.') . EOL);
-                               return;
-                       }
+               // Canonicalise email-style profile locator
+               $url = Probe::webfingerDfrn($url,$hcard);
 
-                       $addr    = $url;
-                       $name    = ($realname) ? $realname : $addr;
-                       $nick    = substr($addr,0,strpos($addr,'@'));
-                       $url     = 'http://' . substr($addr,strpos($addr,'@') + 1);
-                       $nurl    = normalise_url($host);
-                       $poll    = 'email ' . random_string();
-                       $notify  = 'smtp ' . random_string();
-                       $network = NETWORK_MAIL2;
-                       $rel     = CONTACT_IS_FOLLOWER;
-
-                       $mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
-                       if(Config::get('system','dfrn_only'))
-                               $mail_disabled = 1;
-
-                       if(! $mail_disabled) {
-                               $failed = false;
-                               $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
-                                       intval($uid)
-                               );
+               if (substr($url,0,5) === 'stat:') {
 
-                               if (! DBM::is_result($r)) {
-                                       notice( t('This account has not been configured for email. Request failed.') . EOL);
-                                       return;
-                               }
+                       // Every time we detect the remote subscription we define this as OStatus.
+                       // We do this even if it is not OStatus.
+                       // we only need to pass this through another section of the code.
+                       if ($network != NETWORK_DIASPORA) {
+                               $network = NETWORK_OSTATUS;
                        }
 
-                       $r = q("insert into contact ( uid, created, addr, name, nick, url, nurl, poll, notify, blocked, pending, network, rel )
-                               values( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d ) ",
-                               intval($uid),
-                               dbesc(datetime_convert()),
-                               dbesc($addr),
-                               dbesc($name),
-                               dbesc($nick),
-                               dbesc($url),
-                               dbesc($nurl),
-                               dbesc($poll),
-                               dbesc($notify),
-                               intval($blocked),
-                               intval($pending),
-                               dbesc($network),
-                               intval($rel)
-                       );
-
-                       $r = q("SELECT `id`, `network` FROM `contact` WHERE `poll` = '%s' AND `uid` = %d LIMIT 1",
-                               dbesc($poll),
-                               intval($uid)
-                       );
-                       if (DBM::is_result($r)) {
-                               $contact_id = $r[0]['id'];
-
-                               $def_gid = get_default_group($uid, $r[0]["network"]);
-                               if (intval($def_gid))
-                                       group_add_member($uid, '', $contact_id, $def_gid);
-
-                               $photo = avatar_img($addr);
-
-                               $r = q("UPDATE `contact` SET
-                                       `photo` = '%s',
-                                       `thumb` = '%s',
-                                       `micro` = '%s',
-                                       `name-date` = '%s',
-                                       `uri-date` = '%s',
-                                       `avatar-date` = '%s',
-                                       `hidden` = 0,
-                                       WHERE `id` = %d
-                               ",
-                                       dbesc($photos[0]),
-                                       dbesc($photos[1]),
-                                       dbesc($photos[2]),
-                                       dbesc(datetime_convert()),
-                                       dbesc(datetime_convert()),
-                                       dbesc(datetime_convert()),
-                                       intval($contact_id)
-                               );
-                       }
-
-                       // contact is created. Now create an introduction
-
-                       $hash = random_string();
-
-                       $r = q("INSERT INTO `intro` ( `uid`, `contact-id`, knowyou, note, hash, datetime, blocked )
-                               VALUES( %d , %d, %d, '%s', '%s', '%s', %d ) ",
-                               intval($uid),
-                               intval($contact_id),
-                               ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
-                               dbesc(notags(trim($_POST['dfrn-request-message']))),
-                               dbesc($hash),
-                               dbesc(datetime_convert()),
-                               1
-                       );
-
-                       // Next send an email verify form to the requestor.
-
+                       $url = substr($url,5);
                } else {
-                       // Detect the network
-                       $data = Probe::uri($url);
-                       $network = $data["network"];
-
-                       // Canonicalise email-style profile locator
-                       $url = Probe::webfingerDfrn($url,$hcard);
-
-                       if (substr($url,0,5) === 'stat:') {
-
-                               // Every time we detect the remote subscription we define this as OStatus.
-                               // We do this even if it is not OStatus.
-                               // we only need to pass this through another section of the code.
-                               if ($network != NETWORK_DIASPORA)
-                                       $network = NETWORK_OSTATUS;
-
-                               $url = substr($url,5);
-                       } else
-                               $network = NETWORK_DFRN;
+                       $network = NETWORK_DFRN;
                }
 
                logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
@@ -849,27 +720,6 @@ function dfrn_request_content(App $a) {
 
                $page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");
 
-               // see if we are allowed to have NETWORK_MAIL2 contacts
-
-               $mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
-
-               if (Config::get('system','dfrn_only')) {
-                       $mail_disabled = 1;
-               }
-
-               if (! $mail_disabled) {
-                       $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
-                               intval($a->profile['uid'])
-                       );
-                       if (! DBM::is_result($r)) {
-                               $mail_disabled = 1;
-                       }
-               }
-
-               // "coming soon" is disabled for now
-               //$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
-               $emailnet = "";
-
                $invite_desc = sprintf(
                        t('If you are not yet a member of the free social web, <a href="%s/siteinfo">follow this link to find a public Friendica site and join us today</a>.'),
                        get_server()
@@ -877,7 +727,7 @@ function dfrn_request_content(App $a) {
 
                $o = replace_macros($tpl,array(
                        '$header' => t('Friend/Connection Request'),
-                       '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
+                       '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'),
                        '$pls_answer' => t('Please answer the following:'),
                        '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$a->profile['name']), false, '', array(t('No'), t('Yes'))),
                        /*'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
@@ -886,12 +736,11 @@ function dfrn_request_content(App $a) {
                        '$add_note' => t('Add a personal note:'),
                        '$page_desc' => $page_desc,
                        '$friendica' => t('Friendica'),
-                       '$statusnet' => t('StatusNet/Federated Social Web'),
-                       '$diaspora' => t('Diaspora'),
+                       '$statusnet' => t('GNU Social (Pleroma, Mastodon)'),
+                       '$diaspora' => t('Diaspora (Socialhome, Hubzilla)'),
                        '$diasnote' => sprintf (t(' - please do not use this form.  Instead, enter %s into your Diaspora search bar.'),$target_addr),
                        '$your_address' => t('Your Identity Address:'),
                        '$invite_desc' => $invite_desc,
-                       '$emailnet' => $emailnet,
                        '$submit' => t('Submit Request'),
                        '$cancel' => t('Cancel'),
                        '$nickname' => $a->argv[1],
index 57c9339047707e2c95ce4889d30c8f201f82e170..a9cdfe9bbbd262018d4a35edba7c52c49e714dbc 100644 (file)
@@ -1,6 +1,9 @@
 <?php
-
+/**
+ * @file mod/editpost.php
+ */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -131,7 +134,7 @@ function editpost_content(App $a) {
                '$title' => htmlspecialchars($itm[0]['title']),
                '$placeholdertitle' => t('Set title'),
                '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
-               '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
+               '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
                '$emtitle' => t('Example: bob@example.com, mary@example.com'),
                '$lockstate' => $lockstate,
                '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
index f31497557d7bd98503ec166c3def6bbf2216ff89..0403945efcc0ed7b422889d2426fc4eaf9209f4c 100644 (file)
@@ -18,15 +18,11 @@ function hostxrd_init(App $a) {
                Config::set('system','site_pubkey', $res['pubkey']);
        }
 
-       //$tpl = file_get_contents('view/xrd_host.tpl');
-       /*echo str_replace(array(
-               '$zhost','$zroot','$domain','$zot_post','$bigkey'),array($a->get_hostname(),System::baseUrl(),System::baseUrl(),System::baseUrl() . '/post', salmon_key(Config::get('system','site_pubkey'))),$tpl);*/
        $tpl = get_markup_template('xrd_host.tpl');
        echo replace_macros($tpl, array(
                '$zhost' => $a->get_hostname(),
                '$zroot' => System::baseUrl(),
                '$domain' => System::baseUrl(),
-               '$zot_post' => System::baseUrl() . '/post',
                '$bigkey' => salmon_key(Config::get('system','site_pubkey')),
        ));
        exit();
old mode 100755 (executable)
new mode 100644 (file)
index 803d7f1..0da8ec0
@@ -318,7 +318,7 @@ function check_php(&$phpath, &$checks) {
        $help = "";
        if (!$passed) {
                $help .= t('Could not find a command line version of PHP in the web server PATH.'). EOL;
-               $help .= t("If you don't have a command line version of PHP installed on 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 .= 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 = get_markup_template('field_input.tpl');
                $help .= replace_macros($tpl, array(
index 4f7abf36a35314e5593e8b9096bd4c0afa8023fd..06c0df3b84d5902ede461f243122182da7776d6f 100644 (file)
@@ -1,18 +1,15 @@
 <?php
-
 /**
- * module: invite.php
+ * Module: invite.php
  *
- * send email invitations to join social network
+ * Send email invitations to join social network
  *
  */
-
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-
-require_once('include/email.php');
+use Friendica\Protocol\Email;
 
 function invite_post(App $a) {
 
@@ -78,7 +75,7 @@ function invite_post(App $a) {
                        $nmessage = $message;
                }
 
-               $res = mail($recip, email_header_encode( t('Please join us on Friendica'),'UTF-8'),
+               $res = mail($recip, Email::encodeHeader(t('Please join us on Friendica'),'UTF-8'),
                        $nmessage,
                        "From: " . $a->user['email'] . "\n"
                        . 'Content-type: text/plain; charset=UTF-8' . "\n"
index fbedcd86ba55199d04d4a2f8126c86e3a9624127..ffac1c8e445deb4dddb6c824212d77d83b7bb3fe 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+/**
+ * @file mod/item.php
+ */
 
 /*
  * This is the POST destination for most all locally posted
@@ -14,7 +17,6 @@
  * Posts that originate externally or do not fall into the above
  * posting categories go through item_store() instead of this function.
  */
-
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
@@ -24,11 +26,11 @@ use Friendica\Model\GlobalContact;
 use Friendica\Network\Probe;
 use Friendica\Object\Contact;
 use Friendica\Protocol\Diaspora;
+use Friendica\Protocol\Email;
 use Friendica\Util\Emailer;
 
 require_once 'include/crypto.php';
 require_once 'include/enotify.php';
-require_once 'include/email.php';
 require_once 'include/tags.php';
 require_once 'include/files.php';
 require_once 'include/threads.php';
@@ -1030,9 +1032,9 @@ function item_post(App $a) {
                                $disclaimer .= sprintf( t('You may visit them online at %s'), System::baseUrl() . '/profile/' . $a->user['nickname']) . EOL;
                                $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
                                if (!$datarray['title']=='') {
-                                       $subject = email_header_encode($datarray['title'], 'UTF-8');
+                                       $subject = Email::encodeHeader($datarray['title'], 'UTF-8');
                                } else {
-                                       $subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'), $a->user['username']), 'UTF-8');
+                                       $subject = Email::encodeHeader('[Friendica]' . ' ' . sprintf( t('%s posted an update.'), $a->user['username']), 'UTF-8');
                                }
                                $link = '<a href="' . System::baseUrl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
                                $html    = prepare_body($datarray);
old mode 100755 (executable)
new mode 100644 (file)
index 1a30effd4eba82e3b7fdc9d819bd76fe7b965112..b3304fda12bba312b3149025bb21f3f8c76b2107 100644 (file)
@@ -1,12 +1,13 @@
 <?php
-
+/**
+ * @file mod/lostpass.php
+ */
 use Friendica\App;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 
-require_once('include/email.php');
-require_once('include/enotify.php');
-require_once('include/text.php');
+require_once 'include/enotify.php';
+require_once 'include/text.php';
 
 function lostpass_post(App $a) {
 
index e74df1633aab0daebfeb440826aa1ac1788f9a2f..7e61d083f68d8e87f338ce7ac323dc8b2bca19d8 100644 (file)
@@ -3,6 +3,7 @@
  * @file mod/network.php
  */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Content\ForumManager;
 use Friendica\Core\System;
 use Friendica\Core\Config;
@@ -156,8 +157,8 @@ function network_init(App $a) {
                $a->page['aside'] = '';
        }
 
-       $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
-       $a->page['aside'] .= (feature_enabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
+       $a->page['aside'] .= (Feature::isEnabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
+       $a->page['aside'] .= (Feature::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
        $a->page['aside'] .= posted_date_widget('network',local_user(),false);
        $a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
        $a->page['aside'] .= saved_searches($search);
@@ -166,7 +167,7 @@ function network_init(App $a) {
 
 function saved_searches($search) {
 
-       if (!feature_enabled(local_user(),'savedsearch')) {
+       if (!Feature::isEnabled(local_user(),'savedsearch')) {
                return '';
        }
 
@@ -918,7 +919,7 @@ function network_tabs(App $a)
                ),
        );
 
-       if (feature_enabled(local_user(),'personal_tab')) {
+       if (Feature::isEnabled(local_user(),'personal_tab')) {
                $tabs[] = array(
                        'label' => t('Personal'),
                        'url'   => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
@@ -929,7 +930,7 @@ function network_tabs(App $a)
                );
        }
 
-       if (feature_enabled(local_user(),'new_tab')) {
+       if (Feature::isEnabled(local_user(),'new_tab')) {
                $tabs[] = array(
                        'label' => t('New'),
                        'url'   => 'network/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
@@ -940,7 +941,7 @@ function network_tabs(App $a)
                );
        }
 
-       if (feature_enabled(local_user(),'link_tab')) {
+       if (Feature::isEnabled(local_user(),'link_tab')) {
                $tabs[] = array(
                        'label' => t('Shared Links'),
                        'url'   => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
@@ -951,7 +952,7 @@ function network_tabs(App $a)
                );
        }
 
-       if (feature_enabled(local_user(),'star_posts')) {
+       if (Feature::isEnabled(local_user(),'star_posts')) {
                $tabs[] = array(
                        'label' => t('Starred'),
                        'url'   => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
index 54618bdf8f1776d9af5c4650b5ef740985ce3554..95d16f2dd2ca495c341466d672743d7cda436429 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-/* identi.ca -> friendica items permanent-url compatibility */
+/* GNU Social -> friendica items permanent-url compatibility */
 
 use Friendica\App;
 use Friendica\Core\System;
index 504f0ff1460df4fa5cc6b695c0c9568834fb15be..3e2c44e3cd9a70292d6babccd36a26a23b8004d0 100644 (file)
@@ -3,6 +3,7 @@
  * @file mod/photos.php
  */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
@@ -895,7 +896,7 @@ function photos_post(App $a) {
 
        /// @TODO merge these 2 if() into one?
        if ($exif && $exif['GPS']) {
-               if (feature_enabled($channel_id,'photo_location')) {
+               if (Feature::isEnabled($channel_id,'photo_location')) {
                        $lat = getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']);
                        $lon = getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']);
                }
@@ -1584,7 +1585,7 @@ function photos_content(App $a) {
                                $likebuttons = replace_macros($like_tpl, array(
                                        '$id' => $link_item['id'],
                                        '$likethis' => t("I like this \x28toggle\x29"),
-                                       '$nolike' => (feature_enabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''),
+                                       '$nolike' => (Feature::isEnabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''),
                                        '$wait' => t('Please wait'),
                                        '$return_path' => $a->query_string,
                                ));
@@ -1735,7 +1736,7 @@ function photos_content(App $a) {
 
 
                $response_verbs = array('like');
-               if (feature_enabled($owner_uid, 'dislike')) {
+               if (Feature::isEnabled($owner_uid, 'dislike')) {
                        $response_verbs[] = 'dislike';
                }
                $responses = get_responses($conv_responses,$response_verbs, '', $link_item);
index 99d5777ea02081388ddea6a3c69114ecd4d3281d..0f2a9584b863daf54454370990e53b29fb007f62 100644 (file)
@@ -3,6 +3,7 @@
  * @file include/ping.php
  */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Content\ForumManager;
 use Friendica\Core\Cache;
 use Friendica\Core\System;
@@ -149,7 +150,7 @@ function ping_init(App $a)
                }
 
                if ($network_count) {
-                       if (intval(feature_enabled(local_user(), 'groups'))) {
+                       if (intval(Feature::isEnabled(local_user(), 'groups'))) {
                                // Find out how unseen network posts are spread across groups
                                $group_counts = groups_count_unseen();
                                if (DBM::is_result($group_counts)) {
@@ -161,7 +162,7 @@ function ping_init(App $a)
                                }
                        }
 
-                       if (intval(feature_enabled(local_user(), 'forumlist_widget'))) {
+                       if (intval(Feature::isEnabled(local_user(), 'forumlist_widget'))) {
                                $forum_counts = ForumManager::countUnseenItems();
                                if (DBM::is_result($forums_counts)) {
                                        foreach ($forums_counts as $forum_count) {
diff --git a/mod/post.php b/mod/post.php
deleted file mode 100644 (file)
index 8e27964..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * Zot endpoint
- */
-
-use Friendica\App;
-use Friendica\Database\DBM;
-
-require_once('include/salmon.php');
-require_once('include/crypto.php');
-// not yet ready for prime time
-//require_once('include/zot.php');
-
-function post_post(App $a) {
-
-       $bulk_delivery = false;
-
-       if ($a->argc == 1) {
-               $bulk_delivery = true;
-       }
-       else {
-               $nickname = $a->argv[2];
-               $r = q("SELECT * FROM `user` WHERE `nickname` = '%s'
-                               AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
-                       dbesc($nickname)
-               );
-               if (! DBM::is_result($r)) {
-                       http_status_exit(500);
-               }
-
-               $importer = $r[0];
-       }
-
-       $xml = file_get_contents('php://input');
-
-       logger('mod-post: new zot: ' . $xml, LOGGER_DATA);
-
-       if(! $xml)
-               http_status_exit(500);
-
-       $msg = zot_decode($importer,$xml);
-
-       logger('mod-post: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
-
-       if(! is_array($msg))
-               http_status_exit(500);
-
-       $ret = 0;
-       $ret = zot_incoming($bulk_delivery, $importer,$msg);
-       http_status_exit(($ret) ? $ret : 200);
-       // NOTREACHED
-}
-
index 75023beb64180038cc09c15b20cebaa166efba26..eca13bf10c087ce80028f0aa1b4b2eaef0db9240 100644 (file)
@@ -3,6 +3,7 @@
  * @file mod/profiles.php
  */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -673,10 +674,10 @@ function profiles_content(App $a) {
                                array(t('No'), t('Yes')) //Off - On strings
                        ),
 
-                       '$multi_profiles'               => feature_enabled(local_user(), 'multi_profiles'),
+                       '$multi_profiles'               => Feature::isEnabled(local_user(), 'multi_profiles'),
                        '$form_security_token'          => get_form_security_token("profile_edit"),
                        '$form_security_token_photo'    => get_form_security_token("profile_photo"),
-                       '$profile_clone_link'           => ((feature_enabled(local_user(), 'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
+                       '$profile_clone_link'           => ((Feature::isEnabled(local_user(), 'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
                        '$profile_drop_link'            => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
 
                        '$profile_action' => t('Profile Actions'),
@@ -754,7 +755,7 @@ function profiles_content(App $a) {
                return $o;
        } else {
                // If we don't support multi profiles, don't display this list.
-               if (!feature_enabled(local_user(), 'multi_profiles')) {
+               if (!Feature::isEnabled(local_user(), 'multi_profiles')) {
                        $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
                                local_user()
                        );
index 8241325bf99398941f8227da1725fda6778836a5..467a0d00a5982a3622c45b8bef04b3fda2bca7d9 100644 (file)
@@ -1,7 +1,7 @@
 <?php
-
 /**
- * Diaspora endpoint
+ * @file mod/receive.php
+ * @brief Diaspora endpoint
  */
 
 use Friendica\App;
@@ -9,10 +9,14 @@ use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Diaspora;
 
-require_once('include/salmon.php');
-require_once('include/crypto.php');
+require_once 'include/crypto.php';
 
-function receive_post(App $a) {
+/**
+ * @param object $a App
+ * @return void
+ */
+function receive_post(App $a)
+{
        $enabled = intval(Config::get('system', 'diaspora_enabled'));
        if (!$enabled) {
                logger('mod-diaspora: disabled');
@@ -44,7 +48,7 @@ function receive_post(App $a) {
 
        if (!$xml) {
                $postdata = file_get_contents("php://input");
-               if ($postdata == '') {
+               if ($postdata == '') {
                        http_status_exit(500);
                }
 
@@ -80,4 +84,3 @@ function receive_post(App $a) {
        http_status_exit(($ret) ? 200 : 500);
        // NOTREACHED
 }
-
index cd6385144cd21e660b13327d073b60f136357160..4f6dedd24bc7293fcd911b7bc60d06a5c1f817dc 100644 (file)
@@ -5,10 +5,10 @@ use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
+use Friendica\Model\User;
 
-require_once('include/enotify.php');
-require_once('include/bbcode.php');
-require_once('include/user.php');
+require_once 'include/enotify.php';
+require_once 'include/bbcode.php';
 
 if(! function_exists('register_post')) {
 function register_post(App $a) {
@@ -61,7 +61,7 @@ function register_post(App $a) {
        $arr['verified'] = $verified;
        $arr['language'] = get_browser_language();
 
-       $result = create_user($arr);
+       $result = User::create($arr);
 
        if(! $result['success']) {
                notice($result['message']);
@@ -89,7 +89,7 @@ function register_post(App $a) {
 
                // Only send a password mail when the password wasn't manually provided
                if (!x($_POST,'password1') || !x($_POST,'confirm')) {
-                       $res = send_register_open_eml(
+                       $res = User::sendRegisterOpenEmail(
                                $user['email'],
                                $a->config['sitename'],
                                System::baseUrl(),
@@ -159,7 +159,7 @@ function register_post(App $a) {
                        ));
                }
                // send notification to the user, that the registration is pending
-               send_register_pending_eml(
+               User::sendRegisterPendingEmail(
                                $user['email'],
                                $a->config['sitename'],
                                $user['username']);
index 6d76e7ea7eb7f8814d892283ace04fa144782aac..2c5d61059ac9aaf25411e195ec70399e37a928cd 100644 (file)
@@ -6,11 +6,10 @@ use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 
-require_once('include/enotify.php');
-require_once('include/user.php');
-
-function user_allow($hash) {
+require_once 'include/enotify.php';
 
+function user_allow($hash)
+{
        $a = get_app();
 
        $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
@@ -18,7 +17,7 @@ function user_allow($hash) {
        );
 
 
-       if (! DBM::is_result($register)) {
+       if (!DBM::is_result($register)) {
                return false;
        }
 
@@ -26,7 +25,7 @@ function user_allow($hash) {
                intval($register[0]['uid'])
        );
 
-       if (! DBM::is_result($user)) {
+       if (!DBM::is_result($user)) {
                killme();
        }
 
@@ -44,14 +43,14 @@ function user_allow($hash) {
        );
        if (DBM::is_result($r) && $r[0]['net-publish']) {
                $url = System::baseUrl() . '/profile/' . $user[0]['nickname'];
-               if ($url && strlen(Config::get('system','directory'))) {
+               if ($url && strlen(Config::get('system', 'directory'))) {
                        Worker::add(PRIORITY_LOW, "Directory", $url);
                }
        }
 
        push_lang($register[0]['language']);
 
-       send_register_open_eml(
+       User::sendRegisterOpenEmail(
                $user[0]['email'],
                $a->config['sitename'],
                System::baseUrl(),
@@ -60,20 +59,17 @@ function user_allow($hash) {
 
        pop_lang();
 
-       if($res) {
-               info( t('Account approved.') . EOL );
+       if ($res) {
+               info(t('Account approved.') . EOL);
                return true;
        }
-
 }
 
-
 // This does not have to go through user_remove() and save the nickname
 // permanently against re-registration, as the person was not yet
 // allowed to have friends on this system
-
-function user_deny($hash) {
-
+function user_deny($hash)
+{
        $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
                dbesc($hash)
        );
@@ -91,23 +87,22 @@ function user_deny($hash) {
 
        notice(sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
        return true;
-
 }
 
-function regmod_content(App $a) {
-
+function regmod_content(App $a)
+{
        global $lang;
 
        $_SESSION['return_url'] = $a->cmd;
 
-       if (! local_user()) {
-               info( t('Please login.') . EOL);
+       if (!local_user()) {
+               info(t('Please login.') . EOL);
                $o .= '<br /><br />' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
                return $o;
        }
 
-       if ((!is_site_admin()) || (x($_SESSION,'submanage') && intval($_SESSION['submanage']))) {
-               notice( t('Permission denied.') . EOL);
+       if ((!is_site_admin()) || (x($_SESSION, 'submanage') && intval($_SESSION['submanage']))) {
+               notice(t('Permission denied.') . EOL);
                return '';
        }
 
@@ -115,20 +110,18 @@ function regmod_content(App $a) {
                killme();
        }
 
-       $cmd  = $a->argv[1];
+       $cmd = $a->argv[1];
        $hash = $a->argv[2];
 
-
-
        if ($cmd === 'deny') {
                user_deny($hash);
-               goaway(System::baseUrl()."/admin/users/");
+               goaway(System::baseUrl() . "/admin/users/");
                killme();
        }
 
        if ($cmd === 'allow') {
                user_allow($hash);
-               goaway(System::baseUrl()."/admin/users/");
+               goaway(System::baseUrl() . "/admin/users/");
                killme();
        }
 }
old mode 100755 (executable)
new mode 100644 (file)
index 919204a48b2f65fbb4348c0842c480958d42c0fc..4d8b130f94cca342700f343a58299b8a7b8651b8 100644 (file)
@@ -6,8 +6,8 @@ use Friendica\App;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 use Friendica\Protocol\OStatus;
+use Friendica\Protocol\Salmon;
 
-require_once 'include/salmon.php';
 require_once 'include/crypto.php';
 require_once 'include/items.php';
 require_once 'include/follow.php';
@@ -103,7 +103,7 @@ function salmon_post(App $a) {
 
        logger('mod-salmon: Fetching key for ' . $author_link);
 
-       $key = get_salmon_key($author_link,$keyhash);
+       $key = Salmon::getKey($author_link, $keyhash);
 
        if(! $key) {
                logger('mod-salmon: Could not retrieve author key.');
index 984167fd78dc8367342519076c89c3f1f987dfc2..c17b11c5d9a46c3025d143232da52a6c68e2a30c 100644 (file)
@@ -1,20 +1,23 @@
 <?php
-
+/**
+ * @file mod/search.php
+ */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 
-require_once("include/bbcode.php");
-require_once('include/security.php');
-require_once('include/conversation.php');
-require_once('mod/dirfind.php');
+require_once "include/bbcode.php";
+require_once 'include/security.php';
+require_once 'include/conversation.php';
+require_once 'mod/dirfind.php';
 
 function search_saved_searches() {
 
        $o = '';
 
-       if (! feature_enabled(local_user(),'savedsearch'))
+       if (! Feature::isEnabled(local_user(),'savedsearch'))
                return $o;
 
        $r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d",
index 8ad82b023d67501f973e4b28a4fc554ac6651e8c..778a1d8a772dcc01900b9bcae7762f64a31077b1 100644 (file)
@@ -3,6 +3,7 @@
  * @file mod/settings.php
  */
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Core\Config;
@@ -10,6 +11,7 @@ use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 use Friendica\Model\GlobalContact;
 use Friendica\Model\User;
+use Friendica\Protocol\Email;
 
 require_once 'include/group.php';
 
@@ -51,7 +53,7 @@ function settings_init(App $a) {
                ),
        );
 
-       if (get_features()) {
+       if (Feature::get()) {
                $tabs[] =       array(
                                        'label' => t('Additional features'),
                                        'url'   => 'settings/features',
@@ -259,12 +261,12 @@ function settings_post(App $a) {
                                );
                                if (DBM::is_result($r)) {
                                        $eacct = $r[0];
-                                       require_once('include/email.php');
-                                       $mb = construct_mailbox_name($eacct);
+                                       $mb = Email::constructMailboxName($eacct);
+
                                        if (strlen($eacct['server'])) {
                                                $dcrpass = '';
                                                openssl_private_decrypt(hex2bin($eacct['pass']), $dcrpass, $a->user['prvkey']);
-                                               $mbox = email_connect($mb, $mail_user, $dcrpass);
+                                               $mbox = Email::connect($mb, $mail_user, $dcrpass);
                                                unset($dcrpass);
                                                if (!$mbox) {
                                                        $failed = true;
@@ -347,7 +349,6 @@ function settings_post(App $a) {
                        }
                }
 
-
                $r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d",
                                dbesc($theme),
                                intval(local_user())
@@ -369,7 +370,6 @@ function settings_post(App $a) {
        call_hooks('settings_post', $_POST);
 
        if (x($_POST, 'password') || x($_POST, 'confirm')) {
-
                $newpass = $_POST['password'];
                $confirm = $_POST['confirm'];
 
@@ -384,9 +384,8 @@ function settings_post(App $a) {
                        $err = true;
         }
 
-        //  check if the old password was supplied correctly before
-        //  changing it to the new value
-        if (User::authenticate(intval(local_user()), $_POST['opassword'])) {
+        //  check if the old password was supplied correctly before changing it to the new value
+        if (!User::authenticate(intval(local_user()), $_POST['opassword'])) {
             notice(t('Wrong password.') . EOL);
             $err = true;
         }
@@ -397,14 +396,14 @@ function settings_post(App $a) {
                                dbesc($password),
                                intval(local_user())
                        );
-                       if ($r)
+                       if ($r) {
                                info(t('Password changed.') . EOL);
-                       else
+                       } else {
                                notice(t('Password update failed. Please try again.') . EOL);
+                       }
                }
        }
 
-
        $username         = ((x($_POST, 'username'))   ? notags(trim($_POST['username']))     : '');
        $email            = ((x($_POST, 'email'))      ? notags(trim($_POST['email']))        : '');
        $timezone         = ((x($_POST, 'timezone'))   ? notags(trim($_POST['timezone']))     : '');
@@ -786,12 +785,12 @@ function settings_content(App $a) {
        if (($a->argc > 1) && ($a->argv[1] === 'features')) {
 
                $arr = array();
-               $features = get_features();
+               $features = Feature::get();
                foreach ($features as $fname => $fdata) {
                        $arr[$fname] = array();
                        $arr[$fname][0] = $fdata[0];
                        foreach (array_slice($fdata,1) as $f) {
-                               $arr[$fname][1][] = array('feature_' .$f[0], $f[1],((intval(feature_enabled(local_user(), $f[0]))) ? "1" : ''), $f[2],array(t('Off'), t('On')));
+                               $arr[$fname][1][] = array('feature_' .$f[0], $f[1],((intval(Feature::isEnabled(local_user(), $f[0]))) ? "1" : ''), $f[2],array(t('Off'), t('On')));
                        }
                }
 
index 9f88d85eafacd26b0f0336ad750eb647c287b4e3..49fdde25448a215881883802971c00d64dc529ca 100644 (file)
@@ -94,7 +94,6 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r) {
                '$profile_url' => $profile_url,
                '$hcard_url'   => System::baseUrl() . '/hcard/'         . $r['nickname'],
                '$atom'        => System::baseUrl() . '/dfrn_poll/'     . $r['nickname'],
-               '$zot_post'    => System::baseUrl() . '/post/'          . $r['nickname'],
                '$poco_url'    => System::baseUrl() . '/poco/'          . $r['nickname'],
                '$photo'       => System::baseUrl() . '/photo/profile/' . $r['uid']      . '.jpg',
                '$baseurl' => System::baseUrl(),
diff --git a/src/Content/Feature.php b/src/Content/Feature.php
new file mode 100644 (file)
index 0000000..c98a53c
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+/**
+ * @file src/Content/Feature.php
+ * @brief Features management
+ */
+namespace Friendica\Content;
+
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
+
+require_once 'include/plugin.php';
+
+class Feature
+{
+       /**
+        * @brief check if feature is enabled
+        *
+        * @param integer $uid     user id
+        * @param string  $feature feature
+        * @return boolean
+        */
+       public static function isEnabled($uid, $feature)
+       {
+               $x = Config::get('feature_lock', $feature, false);
+
+               if ($x === false) {
+                       $x = PConfig::get($uid, 'feature', $feature, false);
+               }
+
+               if ($x === false) {
+                       $x = Config::get('feature', $feature, false);
+               }
+
+               if ($x === false) {
+                       $x = self::getDefault($feature);
+               }
+
+               $arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
+               call_hooks('isEnabled', $arr);
+               return($arr['enabled']);
+       }
+
+       /**
+        * @brief check if feature is enabled or disabled by default
+        *
+        * @param string $feature feature
+        * @return boolean
+        */
+       private static function getDefault($feature)
+       {
+               $f = self::get();
+               foreach ($f as $cat) {
+                       foreach ($cat as $feat) {
+                               if (is_array($feat) && $feat[0] === $feature) {
+                                       return $feat[3];
+                               }
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * @brief Get a list of all available features
+        *
+        * The array includes the setting group, the setting name,
+        * explainations for the setting and if it's enabled or disabled
+        * by default
+        *
+        * @param bool $filtered True removes any locked features
+        *
+        * @return array
+        */
+       public static function get($filtered = true)
+       {
+               $arr = array(
+
+                       // General
+                       'general' => array(
+                               t('General Features'),
+                               //array('expire',         t('Content Expiration'),              t('Remove old posts/comments after a period of time')),
+                               array('multi_profiles', t('Multiple Profiles'),                 t('Ability to create multiple profiles'), false, Config::get('feature_lock', 'multi_profiles', false)),
+                               array('photo_location', t('Photo Location'),                    t('Photo metadata is normally stripped. This extracts the location (if present) prior to stripping metadata and links it to a map.'), false, Config::get('feature_lock', 'photo_location', false)),
+                               array('export_calendar', t('Export Public Calendar'),           t('Ability for visitors to download the public calendar'), false, Config::get('feature_lock', 'export_calendar', false)),
+                       ),
+
+                       // Post composition
+                       'composition' => array(
+                               t('Post Composition Features'),
+                               array('preview',        t('Post Preview'),                      t('Allow previewing posts and comments before publishing them'), false, Config::get('feature_lock', 'preview', false)),
+                               array('aclautomention', t('Auto-mention Forums'),               t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, Config::get('feature_lock', 'aclautomention', false)),
+                       ),
+
+                       // Network sidebar widgets
+                       'widgets' => array(
+                               t('Network Sidebar Widgets'),
+                               array('archives',       t('Search by Date'),                    t('Ability to select posts by date ranges'), false, Config::get('feature_lock', 'archives', false)),
+                               array('forumlist_widget', t('List Forums'),                     t('Enable widget to display the forums your are connected with'), true, Config::get('feature_lock', 'forumlist_widget', false)),
+                               array('groups',         t('Group Filter'),                      t('Enable widget to display Network posts only from selected group'), false, Config::get('feature_lock', 'groups', false)),
+                               array('networks',       t('Network Filter'),                    t('Enable widget to display Network posts only from selected network'), false, Config::get('feature_lock', 'networks', false)),
+                               array('savedsearch',    t('Saved Searches'),                    t('Save search terms for re-use'), false, Config::get('feature_lock', 'savedsearch', false)),
+                       ),
+
+                       // Network tabs
+                       'net_tabs' => array(
+                               t('Network Tabs'),
+                               array('personal_tab',   t('Network Personal Tab'),              t('Enable tab to display only Network posts that you\'ve interacted on'), false, Config::get('feature_lock', 'personal_tab', false)),
+                               array('new_tab',        t('Network New Tab'),                   t('Enable tab to display only new Network posts (from the last 12 hours)'), false, Config::get('feature_lock', 'new_tab', false)),
+                               array('link_tab',       t('Network Shared Links Tab'),          t('Enable tab to display only Network posts with links in them'), false, Config::get('feature_lock', 'link_tab', false)),
+                       ),
+
+                       // Item tools
+                       'tools' => array(
+                               t('Post/Comment Tools'),
+                               array('multi_delete',   t('Multiple Deletion'),                 t('Select and delete multiple posts/comments at once'), false, Config::get('feature_lock', 'multi_delete', false)),
+                               array('edit_posts',     t('Edit Sent Posts'),                   t('Edit and correct posts and comments after sending'), false, Config::get('feature_lock', 'edit_posts', false)),
+                               array('commtag',        t('Tagging'),                           t('Ability to tag existing posts'), false, Config::get('feature_lock', 'commtag', false)),
+                               array('categories',     t('Post Categories'),                   t('Add categories to your posts'), false, Config::get('feature_lock', 'categories', false)),
+                               array('filing',         t('Saved Folders'),                     t('Ability to file posts under folders'), false, Config::get('feature_lock', 'filing', false)),
+                               array('dislike',        t('Dislike Posts'),                     t('Ability to dislike posts/comments'), false, Config::get('feature_lock', 'dislike', false)),
+                               array('star_posts',     t('Star Posts'),                        t('Ability to mark special posts with a star indicator'), false, Config::get('feature_lock', 'star_posts', false)),
+                               array('ignore_posts',   t('Mute Post Notifications'),           t('Ability to mute notifications for a thread'), false, Config::get('feature_lock', 'ignore_posts', false)),
+                       ),
+
+                       // Advanced Profile Settings
+                       'advanced_profile' => array(
+                               t('Advanced Profile Settings'),
+                               array('forumlist_profile', t('List Forums'),                    t('Show visitors public community forums at the Advanced Profile Page'), false, Config::get('feature_lock', 'forumlist_profile', false)),
+                               array('tagadelic',      t('Tag Cloud'),                         t('Provide a personal tag cloud on your profile page'), false, Config::get('feature_lock', 'tagadelic', false)),
+                       ),
+               );
+
+               // removed any locked features and remove the entire category if this makes it empty
+
+               if ($filtered) {
+                       foreach ($arr as $k => $x) {
+                               $has_items = false;
+                               $kquantity = count($arr[$k]);
+                               for ($y = 0; $y < $kquantity; $y ++) {
+                                       if (is_array($arr[$k][$y])) {
+                                               if ($arr[$k][$y][4] === false) {
+                                                       $has_items = true;
+                                               } else {
+                                                       unset($arr[$k][$y]);
+                                               }
+                                       }
+                               }
+                               if (! $has_items) {
+                                       unset($arr[$k]);
+                               }
+                       }
+               }
+
+               call_hooks('get', $arr);
+               return $arr;
+       }
+}
index e5d153f75960c5988ae34816ddd0c49689450fc8..d619db42b21cd9c774390ab0f797064b864d9843 100644 (file)
@@ -6,6 +6,7 @@
 namespace Friendica\Content;
 
 use Friendica\App;
+use Friendica\Content\Feature;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 use dba;
@@ -82,7 +83,7 @@ class ForumManager
         */
        public static function widget($uid, $cid = 0)
        {
-               if (! intval(feature_enabled(local_user(), 'forumlist_widget'))) {
+               if (! intval(Feature::isEnabled(local_user(), 'forumlist_widget'))) {
                        return;
                }
 
@@ -141,7 +142,7 @@ class ForumManager
         */
        public static function profileAdvanced($uid)
        {
-               $profile = intval(feature_enabled($uid, 'forumlist_profile'));
+               $profile = intval(Feature::isEnabled($uid, 'forumlist_profile'));
                if (! $profile) {
                        return;
                }
index b2beb8e19b7a6fe49efcf290ab1395fa121cbe43..72e3aea939dde21bee049afdc5106def4b2f0cc5 100644 (file)
@@ -7,19 +7,41 @@
 
 namespace Friendica\Model;
 
+use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
+use Friendica\Object\Contact;
+use Friendica\Object\Photo;
 use dba;
 
 require_once 'boot.php';
+require_once 'include/crypto.php';
+require_once 'include/enotify.php';
+require_once 'include/group.php';
+require_once 'include/network.php';
+require_once 'library/openid.php';
+require_once 'include/pgettext.php';
 require_once 'include/plugin.php';
-
+require_once 'include/text.php';
 /**
  * @brief This class handles User related functions
  */
 class User
 {
+       /**
+        * @brief Authenticate a user with a clear text password
+        *
+        * User info can be any of the following:
+        * - User DB object
+        * - User Id
+        * - User email or username or nickname
+        * - User array with at least the uid and the hashed password
+        *
+        * @param mixed $user_info
+        * @param string $password
+        * @return boolean
+        */
        public static function authenticate($user_info, $password)
        {
                if (is_object($user_info)) {
@@ -66,6 +88,424 @@ class User
                return $user['uid'];
        }
 
+       /**
+        * @brief Catch-all user creation function
+        *
+        * Creates a user from the provided data array, either form fields or OpenID.
+        * Required: { username, nickname, email } or { openid_url }
+        *
+        * Performs the following:
+        * - Sends to the OpenId auth URL (if relevant)
+        * - Creates new key pairs for crypto
+        * - Create self-contact
+        * - Create profile image
+        *
+        * @param array $data
+        * @return string
+        */
+       public static function create(array $data)
+       {
+               $a = get_app();
+               $result = array('success' => false, 'user' => null, 'password' => '', 'message' => '');
+
+               $using_invites = Config::get('system', 'invitation_only');
+               $num_invites   = Config::get('system', 'number_invites');
+
+               $invite_id  = x($data, 'invite_id')  ? notags(trim($data['invite_id']))  : '';
+               $username   = x($data, 'username')   ? notags(trim($data['username']))   : '';
+               $nickname   = x($data, 'nickname')   ? notags(trim($data['nickname']))   : '';
+               $email      = x($data, 'email')      ? notags(trim($data['email']))      : '';
+               $openid_url = x($data, 'openid_url') ? notags(trim($data['openid_url'])) : '';
+               $photo      = x($data, 'photo')      ? notags(trim($data['photo']))      : '';
+               $password   = x($data, 'password')   ? trim($data['password'])           : '';
+               $password1  = x($data, 'password1')  ? trim($data['password1'])          : '';
+               $confirm    = x($data, 'confirm')    ? trim($data['confirm'])            : '';
+               $blocked    = x($data, 'blocked')    ? intval($data['blocked'])          : 0;
+               $verified   = x($data, 'verified')   ? intval($data['verified'])         : 0;
+
+               $publish = x($data, 'profile_publish_reg') && intval($data['profile_publish_reg']) ? 1 : 0;
+               $netpublish = strlen(Config::get('system', 'directory')) ? $publish : 0;
+
+               if ($password1 != $confirm) {
+                       $result['message'] .= t('Passwords do not match. Password unchanged.') . EOL;
+                       return $result;
+               } elseif ($password1 != "") {
+                       $password = $password1;
+               }
+
+               $tmp_str = $openid_url;
+
+               if ($using_invites) {
+                       if (!$invite_id) {
+                               $result['message'] .= t('An invitation is required.') . EOL;
+                               return $result;
+                       }
+                       $r = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1", dbesc($invite_id));
+                       if (!results($r)) {
+                               $result['message'] .= t('Invitation could not be verified.') . EOL;
+                               return $result;
+                       }
+               }
+
+               if (!x($username) || !x($email) || !x($nickname)) {
+                       if ($openid_url) {
+                               if (!validate_url($tmp_str)) {
+                                       $result['message'] .= t('Invalid OpenID url') . EOL;
+                                       return $result;
+                               }
+                               $_SESSION['register'] = 1;
+                               $_SESSION['openid'] = $openid_url;
+
+                               $openid = new LightOpenID;
+                               $openid->identity = $openid_url;
+                               $openid->returnUrl = System::baseUrl() . '/openid';
+                               $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
+                               $openid->optional = array('namePerson/first', 'media/image/aspect11', 'media/image/default');
+                               try {
+                                       $authurl = $openid->authUrl();
+                               } catch (Exception $e) {
+                                       $result['message'] .= t("We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.") . EOL . EOL . t("The error message was:") . $e->getMessage() . EOL;
+                                       return $result;
+                               }
+                               goaway($authurl);
+                               // NOTREACHED
+                       }
+
+                       notice(t('Please enter the required information.') . EOL);
+                       return;
+               }
+
+               if (!validate_url($tmp_str)) {
+                       $openid_url = '';
+               }
+
+               $err = '';
+
+               // collapse multiple spaces in name
+               $username = preg_replace('/ +/', ' ', $username);
+
+               if (mb_strlen($username) > 48) {
+                       $result['message'] .= t('Please use a shorter name.') . EOL;
+               }
+               if (mb_strlen($username) < 3) {
+                       $result['message'] .= t('Name too short.') . EOL;
+               }
+
+               // So now we are just looking for a space in the full name.
+
+               $loose_reg = Config::get('system', 'no_regfullname');
+               if (!$loose_reg) {
+                       $username = mb_convert_case($username, MB_CASE_TITLE, 'UTF-8');
+                       if (!strpos($username, ' ')) {
+                               $result['message'] .= t("That doesn't appear to be your full \x28First Last\x29 name.") . EOL;
+                       }
+               }
+
+
+               if (!allowed_email($email)) {
+                       $result['message'] .= t('Your email domain is not among those allowed on this site.') . EOL;
+               }
+
+               if (!valid_email($email) || !validate_email($email)) {
+                       $result['message'] .= t('Not a valid email address.') . EOL;
+               }
+
+               // Disallow somebody creating an account using openid that uses the admin email address,
+               // since openid bypasses email verification. We'll allow it if there is not yet an admin account.
+
+               $adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
+
+               //if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0) && strlen($openid_url)) {
+               if (x($a->config, 'admin_email') && in_array(strtolower($email), $adminlist) && strlen($openid_url)) {
+                       $r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1",
+                               dbesc($email)
+                       );
+                       if (DBM::is_result($r)) {
+                               $result['message'] .= t('Cannot use that email.') . EOL;
+                       }
+               }
+
+               $nickname = $data['nickname'] = strtolower($nickname);
+
+               if (!preg_match("/^[a-z0-9][a-z0-9\_]*$/", $nickname)) {
+                       $result['message'] .= t('Your "nickname" can only contain "a-z", "0-9" and "_".') . EOL;
+               }
+
+               $r = q("SELECT `uid` FROM `user`
+                       WHERE `nickname` = '%s' LIMIT 1",
+                       dbesc($nickname)
+               );
+               if (DBM::is_result($r)) {
+                       $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
+               }
+
+               // Check deleted accounts that had this nickname. Doesn't matter to us,
+               // but could be a security issue for federated platforms.
+
+               $r = q("SELECT * FROM `userd`
+                       WHERE `username` = '%s' LIMIT 1",
+                       dbesc($nickname)
+               );
+               if (DBM::is_result($r)) {
+                       $result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
+               }
+
+               if (strlen($result['message'])) {
+                       return $result;
+               }
+
+               $new_password = strlen($password) ? $password : autoname(6) . mt_rand(100, 9999);
+               $new_password_encoded = hash('whirlpool', $new_password);
+
+               $result['password'] = $new_password;
+
+               $keys = new_keypair(4096);
+
+               if ($keys === false) {
+                       $result['message'] .= t('SERIOUS ERROR: Generation of security keys failed.') . EOL;
+                       return $result;
+               }
+
+               $prvkey = $keys['prvkey'];
+               $pubkey = $keys['pubkey'];
+
+               // Create another keypair for signing/verifying salmon protocol messages.
+               $sres = new_keypair(512);
+               $sprvkey = $sres['prvkey'];
+               $spubkey = $sres['pubkey'];
+
+               $r = q("INSERT INTO `user` (`guid`, `username`, `password`, `email`, `openid`, `nickname`,
+                       `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone`, `default-location`)
+                       VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '')",
+                       dbesc(generate_user_guid()),
+                       dbesc($username),
+                       dbesc($new_password_encoded),
+                       dbesc($email),
+                       dbesc($openid_url),
+                       dbesc($nickname),
+                       dbesc($pubkey),
+                       dbesc($prvkey),
+                       dbesc($spubkey),
+                       dbesc($sprvkey),
+                       dbesc(datetime_convert()),
+                       intval($verified),
+                       intval($blocked)
+               );
+
+               if ($r) {
+                       $r = q("SELECT * FROM `user`
+                               WHERE `username` = '%s' AND `password` = '%s' LIMIT 1",
+                               dbesc($username),
+                               dbesc($new_password_encoded)
+                       );
+                       if (DBM::is_result($r)) {
+                               $u = $r[0];
+                               $newuid = intval($r[0]['uid']);
+                       }
+               } else {
+                       $result['message'] .= t('An error occurred during registration. Please try again.') . EOL;
+                       return $result;
+               }
+
+               /**
+                * if somebody clicked submit twice very quickly, they could end up with two accounts
+                * due to race condition. Remove this one.
+                */
+               $r = q("SELECT `uid` FROM `user`
+                       WHERE `nickname` = '%s' ",
+                       dbesc($nickname)
+               );
+               if (DBM::is_result($r) && count($r) > 1 && $newuid) {
+                       $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
+                       dba::delete('user', array('uid' => $newuid));
+                       return $result;
+               }
+
+               if (x($newuid) !== false) {
+                       $r = q("INSERT INTO `profile` ( `uid`, `profile-name`, `is-default`, `name`, `photo`, `thumb`, `publish`, `net-publish` )
+                               VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, %d ) ",
+                               intval($newuid),
+                               t('default'),
+                               1,
+                               dbesc($username),
+                               dbesc(System::baseUrl() . "/photo/profile/{$newuid}.jpg"),
+                               dbesc(System::baseUrl() . "/photo/avatar/{$newuid}.jpg"),
+                               intval($publish),
+                               intval($netpublish)
+                       );
+                       if ($r === false) {
+                               $result['message'] .= t('An error occurred creating your default profile. Please try again.') . EOL;
+                               // Start fresh next time.
+                               dba::delete('user', array('uid' => $newuid));
+                               return $result;
+                       }
+
+                       // Create the self contact
+                       Contact::createSelfFromUserId($newuid);
+
+                       // Create a group with no members. This allows somebody to use it
+                       // right away as a default group for new contacts.
+
+                       group_add($newuid, t('Friends'));
+
+                       $r = q("SELECT `id` FROM `group` WHERE `uid` = %d AND `name` = '%s'",
+                               intval($newuid),
+                               dbesc(t('Friends'))
+                       );
+                       if (DBM::is_result($r)) {
+                               $def_gid = $r[0]['id'];
+
+                               q("UPDATE `user` SET `def_gid` = %d WHERE `uid` = %d",
+                                       intval($r[0]['id']),
+                                       intval($newuid)
+                               );
+                       }
+
+                       if (Config::get('system', 'newuser_private') && $def_gid) {
+                               q("UPDATE `user` SET `allow_gid` = '%s' WHERE `uid` = %d",
+                                       dbesc("<" . $def_gid . ">"),
+                                       intval($newuid)
+                               );
+                       }
+               }
+
+               // if we have no OpenID photo try to look up an avatar
+               if (!strlen($photo)) {
+                       $photo = avatar_img($email);
+               }
+
+               // unless there is no avatar-plugin loaded
+               if (strlen($photo)) {
+                       $photo_failure = false;
+
+                       $filename = basename($photo);
+                       $img_str = fetch_url($photo, true);
+                       // guess mimetype from headers or filename
+                       $type = Photo::guessImageType($photo, true);
+
+
+                       $img = new Photo($img_str, $type);
+                       if ($img->isValid()) {
+                               $img->scaleImageSquare(175);
+
+                               $hash = photo_new_resource();
+
+                               $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4);
+
+                               if ($r === false) {
+                                       $photo_failure = true;
+                               }
+
+                               $img->scaleImage(80);
+
+                               $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5);
+
+                               if ($r === false) {
+                                       $photo_failure = true;
+                               }
+
+                               $img->scaleImage(48);
+
+                               $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6);
+
+                               if ($r === false) {
+                                       $photo_failure = true;
+                               }
+
+                               if (!$photo_failure) {
+                                       q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
+                                               dbesc($hash)
+                                       );
+                               }
+                       }
+               }
+
+               call_hooks('register_account', $newuid);
+
+               $result['success'] = true;
+               $result['user'] = $u;
+               return $result;
+       }
+
+       /**
+        * @brief Sends pending registration confiÅ•mation email
+        *
+        * @param string $email
+        * @param string $sitename
+        * @param string $username
+        * @return NULL|boolean from notification() and email() inherited
+        */
+       public static function sendRegisterPendingEmail($email, $sitename, $username)
+       {
+               $body = deindent(t('
+                       Dear %1$s,
+                               Thank you for registering at %2$s. Your account is pending for approval by the administrator.
+               '));
+
+               $body = sprintf($body, $username, $sitename);
+
+               return notification(array(
+                       'type' => SYSTEM_EMAIL,
+                       'to_email' => $email,
+                       'subject'=> sprintf( t('Registration at %s'), $sitename),
+                       'body' => $body));
+       }
+
+       /**
+        * @brief Sends registration confirmation
+        *
+        * It's here as a function because the mail is sent from different parts
+        *
+        * @param string $email
+        * @param string $sitename
+        * @param string $siteurl
+        * @param string $username
+        * @param string $password
+        * @return NULL|boolean from notification() and email() inherited
+        */
+       public static function sendRegisterOpenEmail($email, $sitename, $siteurl, $username, $password)
+       {
+               $preamble = deindent(t('
+                       Dear %1$s,
+                               Thank you for registering at %2$s. Your account has been created.
+               '));
+               $body = deindent(t('
+                       The login details are as follows:
+                               Site Location:  %3$s
+                               Login Name:     %1$s
+                               Password:       %5$s
+
+                       You may change your password from your account "Settings" page after logging
+                       in.
+
+                       Please take a few moments to review the other account settings on that page.
+
+                       You may also wish to add some basic information to your default profile
+                       (on the "Profiles" page) so that other people can easily find you.
+
+                       We recommend setting your full name, adding a profile photo,
+                       adding some profile "keywords" (very useful in making new friends) - and
+                       perhaps what country you live in; if you do not wish to be more specific
+                       than that.
+
+                       We fully respect your right to privacy, and none of these items are necessary.
+                       If you are new and do not know anybody here, they may help
+                       you to make some new and interesting friends.
+
+
+                       Thank you and welcome to %2$s.'));
+
+               $preamble = sprintf($preamble, $username, $sitename);
+               $body = sprintf($body, $email, $sitename, $siteurl, $username, $password);
+
+               return notification(array(
+                       'type' => SYSTEM_EMAIL,
+                       'to_email' => $email,
+                       'subject'=> sprintf( t('Registration details for %s'), $sitename),
+                       'preamble'=> $preamble,
+                       'body' => $body));
+       }
+
        /**
         * @param object $uid user to remove
         * @return void
diff --git a/src/Network/FKOAuth1.php b/src/Network/FKOAuth1.php
new file mode 100644 (file)
index 0000000..ce2d4a6
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+/**
+ * @file src/Protocol/OAuth1.php
+ */
+namespace Friendica\Network;
+
+use Friendica\App;
+use Friendica\Core\PConfig;
+use Friendica\Core\System;
+use Friendica\Database\DBM;
+use Friendica\Network\FKOAuthDataStore;
+use dba;
+use OAuthServer;
+use OAuthSignatureMethod_PLAINTEXT;
+use OAuthSignatureMethod_HMAC_SHA1;
+
+require_once "library/OAuth1.php";
+require_once "include/plugin.php";
+
+/**
+ * @brief OAuth protocol
+ */
+class FKOAuth1 extends OAuthServer
+{
+       /**
+        * @brief Constructor
+        */
+       public function __construct()
+       {
+               parent::__construct(new FKOAuthDataStore());
+               $this->add_signature_method(new OAuthSignatureMethod_PLAINTEXT());
+               $this->add_signature_method(new OAuthSignatureMethod_HMAC_SHA1());
+       }
+
+       /**
+        * @param string $uid user id
+        * @return void
+        */
+       public function loginUser($uid)
+       {
+               logger("FKOAuth1::loginUser $uid");
+               $a = get_app();
+               $record = dba::select('user', array(), array('uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1), array('limit' => 1));
+
+               if (!DBM::is_result($record)) {
+                       logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+                       header('HTTP/1.0 401 Unauthorized');
+                       die('This api requires login');
+               }
+               $_SESSION['uid'] = $record['uid'];
+               $_SESSION['theme'] = $record['theme'];
+               $_SESSION['mobile-theme'] = PConfig::get($record['uid'], 'system', 'mobile_theme');
+               $_SESSION['authenticated'] = 1;
+               $_SESSION['page_flags'] = $record['page-flags'];
+               $_SESSION['my_url'] = System::baseUrl() . '/profile/' . $record['nickname'];
+               $_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
+               $_SESSION["allow_api"] = true;
+
+               $a->user = $record;
+
+               if (strlen($a->user['timezone'])) {
+                       date_default_timezone_set($a->user['timezone']);
+                       $a->timezone = $a->user['timezone'];
+               }
+
+               $r = dba::select('contact', array(), array('uid' => $_SESSION['uid'], 'self' => 1), array('limit' => 1));
+               
+               if (DBM::is_result($r)) {
+                       $a->contact = $r;
+                       $a->cid = $r['id'];
+                       $_SESSION['cid'] = $a->cid;
+               }
+
+               dba::update('user', ['login_date' => datetime_convert()], ['uid' => $_SESSION['uid']]);
+
+               call_hooks('logged_in', $a->user);
+       }
+}
diff --git a/src/Network/FKOAuthDataStore.php b/src/Network/FKOAuthDataStore.php
new file mode 100644 (file)
index 0000000..d7fa145
--- /dev/null
@@ -0,0 +1,180 @@
+<?php
+/**
+ * @file src/Protocol/FKOAuthDataStore.php
+ * OAuth server
+ * Based on oauth2-php <http://code.google.com/p/oauth2-php/>
+ *
+ */
+namespace Friendica\Network;
+
+use Friendica\App;
+use Friendica\Core\Config;
+use Friendica\Core\System;
+use Friendica\Database\DBM;
+use dba;
+use OAuthDataStore;
+
+define('REQUEST_TOKEN_DURATION', 300);
+define('ACCESS_TOKEN_DURATION', 31536000);
+
+require_once "library/OAuth1.php";
+require_once "library/oauth2-php/lib/OAuth2.inc";
+
+/**
+ * @brief OAuthDataStore class
+ */
+class FKOAuthDataStore extends OAuthDataStore
+{
+       /**
+        * @return string
+        */
+       private static function genToken()
+       {
+               return md5(base64_encode(pack('N6', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid())));
+       }
+
+       /**
+        * @param string $consumer_key key
+        * @return mixed
+        */
+       public function lookup_consumer($consumer_key)
+       {
+               logger(__function__.":".$consumer_key);
+               
+               $s = dba::select('clients', array('client_id', 'pw', 'redirect_uri'), array('client_id' => $consumer_key));
+               $r = dba::inArray($r);
+
+               if (DBM::is_result($r)) {
+                       return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
+               }
+
+               return null;
+       }
+
+       /**
+        * @param string $consumer   consumer
+        * @param string $token_type type
+        * @param string $token      token
+        * @return mixed
+        */
+       public function lookup_token($consumer, $token_type, $token)
+       {
+               logger(__function__.":".$consumer.", ". $token_type.", ".$token);
+               
+               $s = dba::select('tokens', array('id', 'secret', 'scope', 'expires', 'uid'), array('client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token));
+               $r = dba::inArray($s);
+
+               if (DBM::is_result($r)) {
+                       $ot=new OAuthToken($r[0]['id'], $r[0]['secret']);
+                       $ot->scope = $r[0]['scope'];
+                       $ot->expires = $r[0]['expires'];
+                       $ot->uid = $r[0]['uid'];
+                       return $ot;
+               }
+
+               return null;
+       }
+
+       /**
+        * @param string $consumer  consumer
+        * @param string $token     token
+        * @param string $nonce     nonce
+        * @param string $timestamp timestamp
+        * @return mixed
+        */
+       public function lookup_nonce($consumer, $token, $nonce, $timestamp)
+       {
+               $r = dba::select('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp], ['limit' => 1]);
+                               
+               if (DBM::is_result($r)) {
+                       return new OAuthToken($r['id'], $r['secret']);
+               }
+
+               return null;
+       }
+
+       /**
+        * @param string $consumer consumer
+        * @param string $callback optional, default null
+        * @return mixed
+        */
+       public function new_request_token($consumer, $callback = null)
+       {
+               logger(__function__.":".$consumer.", ". $callback);
+               $key = self::genToken();
+               $sec = self::genToken();
+
+               if ($consumer->key) {
+                       $k = $consumer->key;
+               } else {
+                       $k = $consumer;
+               }
+
+               $r = dba::insert(
+                       'tokens',
+                       array(
+                               'id' => $key,
+                               'secret' => $sec,
+                               'client_id' => $k,
+                               'scope' => 'request',
+                               'expires' => UNIX_TIMESTAMP() + REQUEST_TOKEN_DURATION)
+               );
+
+               if (!$r) {
+                       return null;
+               }
+
+               return new OAuthToken($key, $sec);
+       }
+
+       /**
+        * @param string $token    token
+        * @param string $consumer consumer
+        * @param string $verifier optional, defult null
+        * @return object
+        */
+       public function new_access_token($token, $consumer, $verifier = null)
+       {
+               logger(__function__.":".$token.", ". $consumer.", ". $verifier);
+
+               // return a new access token attached to this consumer
+               // for the user associated with this token if the request token
+               // is authorized
+               // should also invalidate the request token
+
+               $ret = null;
+
+               // get user for this verifier
+               $uverifier = Config::get("oauth", $verifier);
+               logger(__function__.":".$verifier.",".$uverifier);
+
+               if (is_null($verifier) || ($uverifier!==false)) {
+                       $key = self::genToken();
+                       $sec = self::genToken();
+                       $r = dba::insert(
+                               'tokens',
+                               array(
+                                       'id' => $key,
+                                       'secret' => $sec,
+                                       'client_id' => $consumer->key,
+                                       'scope' => 'access',
+                                       'expires' => UNIX_TIMESTAMP() + ACCESS_TOKEN_DURATION,
+                                       'uid' => $uverifier)
+                       );
+
+                       if ($r) {
+                               $ret = new OAuthToken($key, $sec);
+                       }
+               }
+
+
+               dba::delete('tokens', array('id' => $token->key));
+
+
+               if (!is_null($ret) && !is_null($uverifier)) {
+                       Config::delete("oauth", $verifier);
+               }
+
+               return $ret;
+       }
+}
index 6001489ec7539bee97bc43a5b5947f05347d3aef..500aa7323fa42fc3b66ece4b4bdc9de1874202bf 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Object\Profile;
+use Friendica\Protocol\Email;
 use Friendica\Util\XML;
 
 use dba;
@@ -22,7 +23,6 @@ use DomXPath;
 use DOMDocument;
 
 require_once 'include/feed.php';
-require_once 'include/email.php';
 require_once 'include/network.php';
 
 /**
@@ -1517,16 +1517,16 @@ class Probe
                        $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
 
                        if (DBM::is_result($x) && DBM::is_result($r)) {
-                               $mailbox = construct_mailbox_name($r[0]);
+                               $mailbox = Email::constructMailboxName($r[0]);
                                $password = '';
                                openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);
-                               $mbox = email_connect($mailbox, $r[0]['user'], $password);
+                               $mbox = Email::connect($mailbox, $r[0]['user'], $password);
                                if (!mbox) {
                                        return false;
                                }
                        }
 
-                       $msgs = email_poll($mbox, $uri);
+                       $msgs = Email::poll($mbox, $uri);
                        logger('searching '.$uri.', '.count($msgs).' messages found.', LOGGER_DEBUG);
 
                        if (!count($msgs)) {
@@ -1546,7 +1546,7 @@ class Probe
                $data["notify"]  = 'smtp '.random_string();
                $data["poll"]    = 'email '.random_string();
 
-               $x = email_msg_meta($mbox, $msgs[0]);
+               $x = Email::messageMeta($mbox, $msgs[0]);
                if (stristr($x[0]->from, $uri)) {
                        $adr = imap_rfc822_parse_adrlist($x[0]->from, '');
                } elseif (stristr($x[0]->to, $uri)) {
index 72f287a3ef04ea35187e5d87a0d085ff22c01ea3..64e61b9ce2a06253f4ec78b5b3f9d6181378cb22 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\Object\Photo;
 use Friendica\Protocol\Diaspora;
 use Friendica\Protocol\DFRN;
 use Friendica\Protocol\OStatus;
+use Friendica\Protocol\Salmon;
 use dba;
 
 require_once 'boot.php';
@@ -27,6 +28,52 @@ require_once 'include/text.php';
  */
 class Contact extends BaseObject
 {
+       /**
+        * Creates the self-contact for the provided user id
+        *
+        * @param int $uid
+        * @return bool Operation success
+        */
+       public static function createSelfFromUserId($uid)
+       {
+               // Only create the entry if it doesn't exist yet
+               if (dba::exists('contact', ['uid' => intval($uid), 'self'])) {
+                       return true;
+               }
+
+               $user = dba::select('user', ['uid', 'username', 'nickname'], ['uid' => intval($uid)], ['limit' => 1]);
+               if (!DBM::is_result($user)) {
+                       return false;
+               }
+
+               $return = dba::insert('contact', [
+                       'uid'         => $user['uid'],
+                       'created'     => datetime_convert(),
+                       'self'        => 1,
+                       'name'        => $user['username'],
+                       'nick'        => $user['nickname'],
+                       'photo'       => System::baseUrl() . '/photo/profile/' . $user['uid'] . '.jpg',
+                       'thumb'       => System::baseUrl() . '/photo/avatar/'  . $user['uid'] . '.jpg',
+                       'micro'       => System::baseUrl() . '/photo/micro/'   . $user['uid'] . '.jpg',
+                       'blocked'     => 0,
+                       'pending'     => 0,
+                       'url'         => System::baseUrl() . '/profile/' . $user['nickname'],
+                       'nurl'        => normalise_link(System::baseUrl() . '/profile/' . $user['nickname']),
+                       'addr'        => $user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3),
+                       'request'     => System::baseUrl() . '/dfrn_request/' . $user['nickname'],
+                       'notify'      => System::baseUrl() . '/dfrn_notify/'  . $user['nickname'],
+                       'poll'        => System::baseUrl() . '/dfrn_poll/'    . $user['nickname'],
+                       'confirm'     => System::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
+                       'poco'        => System::baseUrl() . '/poco/'         . $user['nickname'],
+                       'name-date'   => datetime_convert(),
+                       'uri-date'    => datetime_convert(),
+                       'avatar-date' => datetime_convert(),
+                       'closeness'   => 0
+               ]);
+
+               return $return;
+       }
+
        /**
         * @brief Marks a contact for removal
         *
@@ -71,8 +118,7 @@ class Contact extends BaseObject
                        $slap = OStatus::salmon($item, $user);
 
                        if ((x($contact, 'notify')) && (strlen($contact['notify']))) {
-                               require_once 'include/salmon.php';
-                               slapper($user, $contact['notify'], $slap);
+                               Salmon::slapper($user, $contact['notify'], $slap);
                        }
                } elseif ($contact['network'] === NETWORK_DIASPORA) {
                        Diaspora::sendUnshare($user, $contact);
@@ -95,8 +141,8 @@ class Contact extends BaseObject
         */
        public static function markForArchival(array $contact)
        {
-               // Contact already archived, nothing to do
-               if ($contact['archive']) {
+               // Contact already archived or "self" contact? => nothing to do
+               if ($contact['archive'] || $contact['self']) {
                        return;
                }
 
@@ -104,7 +150,7 @@ class Contact extends BaseObject
                        dba::update('contact', array('term-date' => datetime_convert()), array('id' => $contact['id']));
 
                        if ($contact['url'] != '') {
-                               dba::update('contact', array('term-date' => datetime_convert()), array('`nurl` = ? AND `term-date` <= ?', normalise_link($contact['url']), NULL_DATE));
+                               dba::update('contact', array('term-date' => datetime_convert()), array('`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE));
                        }
                } else {
                        /* @todo
@@ -123,7 +169,7 @@ class Contact extends BaseObject
                                dba::update('contact', array('archive' => 1), array('id' => $contact['id']));
 
                                if ($contact['url'] != '') {
-                                       dba::update('contact', array('archive' => 1), array('nurl' => normalise_link($contact['url'])));
+                                       dba::update('contact', array('archive' => 1), array('nurl' => normalise_link($contact['url']), 'self' => false));
                                }
                        }
                }
@@ -139,7 +185,7 @@ class Contact extends BaseObject
         */
        public static function unmarkForArchival(array $contact)
        {
-               $condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE);
+               $condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], NULL_DATE);
                $exists = dba::exists('contact', $condition);
 
                // We don't need to update, we never marked this contact for archival
@@ -822,7 +868,33 @@ class Contact extends BaseObject
        }
 
        /**
-        * @brief Updates the avatar links in a contact only if needed
+        * @brief Blocks a contact
+        *
+        * @param int $uid
+        * @return bool
+        */
+       public static function block($uid)
+       {
+               $return = dba::update('contact', ['blocked' => true], ['id' => $uid]);
+
+               return $return;
+       }
+
+       /**
+        * @brief Unblocks a contact
+        *
+        * @param int $uid
+        * @return bool
+        */
+       public static function unblock($uid)
+       {
+               $return = dba::update('contact', ['blocked' => false], ['id' => $uid]);
+
+               return $return;
+  }
+
+  /**
+   * @brief Updates the avatar links in a contact only if needed
         *
         * @param string $avatar Link to avatar picture
         * @param int    $uid    User id of contact owner
index cd05b91cf93dde3071573a82f7e255c02cb411a7..1533908aeb375b6ae8e90a9dfa679fb1c67edb0f 100644 (file)
@@ -5,6 +5,7 @@
 namespace Friendica\Object;
 
 use Friendica\BaseObject;
+use Friendica\Content\Feature;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
@@ -161,7 +162,7 @@ class Item extends BaseObject
 
                $drop = array(
                        'dropping' => $dropping,
-                       'pagedrop' => ((feature_enabled($conv->getProfileOwner(), 'multi_delete')) ? $item['pagedrop'] : ''),
+                       'pagedrop' => ((Feature::isEnabled($conv->getProfileOwner(), 'multi_delete')) ? $item['pagedrop'] : ''),
                        'select'   => t('Select'),
                        'delete'   => t('Delete'),
                );
@@ -279,7 +280,7 @@ class Item extends BaseObject
                                }
 
                                $tagger = '';
-                               if (feature_enabled($conv->getProfileOwner(), 'commtag')) {
+                               if (Feature::isEnabled($conv->getProfileOwner(), 'commtag')) {
                                        $tagger = array(
                                                'add'   => t("add tag"),
                                                'class' => "",
@@ -293,7 +294,7 @@ class Item extends BaseObject
                if ($conv->isWritable()) {
                        $buttons = array(
                                'like' => array( t("I like this \x28toggle\x29"), t("like")),
-                               'dislike' => ((feature_enabled($conv->getProfileOwner(), 'dislike')) ? array( t("I don't like this \x28toggle\x29"), t("dislike")) : ''),
+                               'dislike' => ((Feature::isEnabled($conv->getProfileOwner(), 'dislike')) ? array( t("I don't like this \x28toggle\x29"), t("dislike")) : ''),
                        );
                        if ($shareable) {
                                $buttons['share'] = array( t('Share this'), t('share'));
@@ -378,12 +379,12 @@ class Item extends BaseObject
                        'owner_photo'     => $a->remove_baseurl(proxy_url($item['owner-thumb'], false, PROXY_SIZE_THUMB)),
                        'owner_name'      => htmlentities($owner_name_e),
                        'plink'           => get_plink($item),
-                       'edpost'          => ((feature_enabled($conv->getProfileOwner(), 'edit_posts')) ? $edpost : ''),
+                       'edpost'          => ((Feature::isEnabled($conv->getProfileOwner(), 'edit_posts')) ? $edpost : ''),
                        'isstarred'       => $isstarred,
-                       'star'            => ((feature_enabled($conv->getProfileOwner(), 'star_posts')) ? $star : ''),
-                       'ignore'          => ((feature_enabled($conv->getProfileOwner(), 'ignore_posts')) ? $ignore : ''),
+                       'star'            => ((Feature::isEnabled($conv->getProfileOwner(), 'star_posts')) ? $star : ''),
+                       'ignore'          => ((Feature::isEnabled($conv->getProfileOwner(), 'ignore_posts')) ? $ignore : ''),
                        'tagger'          => $tagger,
-                       'filer'           => ((feature_enabled($conv->getProfileOwner(), 'filing')) ? $filer : ''),
+                       'filer'           => ((Feature::isEnabled($conv->getProfileOwner(), 'filing')) ? $filer : ''),
                        'drop'            => $drop,
                        'vote'            => $buttons,
                        'like'            => $responses['like']['output'],
@@ -791,7 +792,7 @@ class Item extends BaseObject
                                '$edimg'       => t('Image'),
                                '$edurl'       => t('Link'),
                                '$edvideo'     => t('Video'),
-                               '$preview'     => ((feature_enabled($conv->getProfileOwner(), 'preview')) ? t('Preview') : ''),
+                               '$preview'     => ((Feature::isEnabled($conv->getProfileOwner(), 'preview')) ? t('Preview') : ''),
                                '$indent'      => $indent,
                                '$sourceapp'   => t($a->sourcename),
                                '$ww'          => (($conv->getMode() === 'network') ? $ww : ''),
index 26412e27044f9ce676794f2be5913e400d6a26d2..cd4e5b6f0e0135980d21efa40b0c62f867ad8bcd 100644 (file)
@@ -1339,10 +1339,6 @@ class Diaspora
                if ($r) {
                        $cid = $r[0]["id"];
                        $network = $r[0]["network"];
-
-                       // We are receiving content from a user that possibly is about to be terminated
-                       // This means the user is vital, so we remove a possible termination date.
-                       Contact::unmarkForArchival($r[0]);
                } else {
                        $cid = $contact["id"];
                        $network = NETWORK_DIASPORA;
diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php
new file mode 100644 (file)
index 0000000..c962de7
--- /dev/null
@@ -0,0 +1,377 @@
+<?php
+/**
+ * @file src/Protocol/Email.php
+ */
+namespace Friendica\Protocol;
+
+require_once 'include/html2plain.php';
+require_once 'include/msgclean.php';
+require_once 'include/quoteconvert.php';
+
+/**
+ * @brief Email class
+ */
+class Email
+{
+       /**
+        * @param string $mailbox  The mailbox name
+        * @param string $username The username
+        * @param string $password The password
+        * @return object
+        */
+       public static function connect($mailbox, $username, $password)
+       {
+               if (! function_exists('imap_open')) {
+                       return false;
+               }
+
+               $mbox = @imap_open($mailbox, $username, $password);
+
+               return $mbox;
+       }
+
+       /**
+        * @param object $mbox       mailbox
+        * @param string $email_addr email
+        * @return array
+        */
+       public static function poll($mbox, $email_addr)
+       {
+               if (! ($mbox && $email_addr))
+                       return array();
+
+               $search1 = @imap_search($mbox, 'FROM "' . $email_addr . '"', SE_UID);
+               if (!$search1) {
+                       $search1 = array();
+               } else {
+                       logger("Found mails from ".$email_addr, LOGGER_DEBUG);
+               }
+
+               $search2 = @imap_search($mbox, 'TO "' . $email_addr . '"', SE_UID);
+               if (!$search2) {
+                       $search2 = array();
+               } else {
+                       logger("Found mails to ".$email_addr, LOGGER_DEBUG);
+               }
+
+               $search3 = @imap_search($mbox, 'CC "' . $email_addr . '"', SE_UID);
+               if (!$search3) {
+                       $search3 = array();
+               } else {
+                       logger("Found mails cc ".$email_addr, LOGGER_DEBUG);
+               }
+
+               $res = array_unique(array_merge($search1, $search2, $search3));
+
+               return $res;
+       }
+
+       /**
+        * @param array $mailacct mail account
+        * @return object
+        */
+       public static function constructMailboxName($mailacct)
+       {
+               $ret = '{' . $mailacct['server'] . ((intval($mailacct['port'])) ? ':' . $mailacct['port'] : '');
+               $ret .= (($mailacct['ssltype']) ?  '/' . $mailacct['ssltype'] . '/novalidate-cert' : '');
+               $ret .= '}' . $mailacct['mailbox'];
+               return $ret;
+       }
+
+       /**
+        * @param object  $mbox mailbox
+        * @param integer $uid  user id
+        * @return mixed
+        */
+       public static function messageMeta($mbox, $uid)
+       {
+               $ret = (($mbox && $uid) ? @imap_fetch_overview($mbox, $uid, FT_UID) : array(array())); // POSSIBLE CLEANUP --> array(array()) is probably redundant now
+               return (count($ret)) ? $ret : array();
+       }
+
+       /**
+        * @param object  $mbox  mailbox
+        * @param integer $uid   user id
+        * @param string  $reply reply
+        * @return array
+        */
+       public static function getMessage($mbox, $uid, $reply)
+       {
+               $ret = array();
+
+               $struc = (($mbox && $uid) ? @imap_fetchstructure($mbox, $uid, FT_UID) : null);
+
+               if (! $struc) {
+                       return $ret;
+               }
+
+               if (! $struc->parts) {
+                       $ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'html');
+                       $html = $ret['body'];
+
+                       if (trim($ret['body']) == '') {
+                               $ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'plain');
+                       } else {
+                               $ret['body'] = html2bbcode($ret['body']);
+                       }
+               } else {
+                       $text = '';
+                       $html = '';
+                       foreach ($struc->parts as $ptop => $p) {
+                               $x = self::messageGetPart($mbox, $uid, $p, $ptop + 1, 'plain');
+                               if ($x) {
+                                       $text .= $x;
+                               }
+
+                               $x = self::messageGetPart($mbox, $uid, $p, $ptop + 1, 'html');
+                               if ($x) {
+                                       $html .= $x;
+                               }
+                       }
+                       if (trim($html) != '') {
+                               $ret['body'] = html2bbcode($html);
+                       } else {
+                               $ret['body'] = $text;
+                       }
+               }
+
+               $ret['body'] = removegpg($ret['body']);
+               $msg = removesig($ret['body']);
+               $ret['body'] = $msg['body'];
+               $ret['body'] = convertquote($ret['body'], $reply);
+
+               if (trim($html) != '') {
+                       $ret['body'] = removelinebreak($ret['body']);
+               }
+
+               $ret['body'] = unifyattributionline($ret['body']);
+
+               return $ret;
+       }
+
+       // At the moment - only return plain/text.
+       // Later we'll repackage inline images as data url's and make the HTML safe
+       /**
+        * @param object  $mbox    mailbox
+        * @param integer $uid     user id
+        * @param object  $p       parts
+        * @param integer $partno  part number
+        * @param string  $subtype sub type
+        * @return string
+        */
+       private static function messageGetPart($mbox, $uid, $p, $partno, $subtype)
+       {
+               // $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
+               global $htmlmsg,$plainmsg,$charset,$attachments;
+
+               //echo $partno."\n";
+
+               // DECODE DATA
+               $data = ($partno)
+                       ? @imap_fetchbody($mbox, $uid, $partno, FT_UID|FT_PEEK)
+               : @imap_body($mbox, $uid, FT_UID|FT_PEEK);
+
+               // Any part may be encoded, even plain text messages, so check everything.
+               if ($p->encoding==4) {
+                       $data = quoted_printable_decode($data);
+               } elseif ($p->encoding==3) {
+                       $data = base64_decode($data);
+               }
+
+               // PARAMETERS
+               // get all parameters, like charset, filenames of attachments, etc.
+               $params = array();
+               if ($p->parameters) {
+                       foreach ($p->parameters as $x) {
+                               $params[strtolower($x->attribute)] = $x->value;
+                       }
+               }
+
+               if (isset($p->dparameters) && $p->dparameters) {
+                       foreach ($p->dparameters as $x) {
+                               $params[strtolower($x->attribute)] = $x->value;
+                       }
+               }
+
+               // ATTACHMENT
+               // Any part with a filename is an attachment,
+               // so an attached text file (type 0) is not mistaken as the message.
+
+               if ((isset($params['filename']) && $params['filename']) || (isset($params['name']) && $params['name'])) {
+                       // filename may be given as 'Filename' or 'Name' or both
+                       $filename = ($params['filename'])? $params['filename'] : $params['name'];
+                       // filename may be encoded, so see imap_mime_header_decode()
+                       $attachments[$filename] = $data;  // this is a problem if two files have same name
+               }
+
+               // TEXT
+               if ($p->type == 0 && $data) {
+                       // Messages may be split in different parts because of inline attachments,
+                       // so append parts together with blank row.
+                       if (strtolower($p->subtype)==$subtype) {
+                               $data = iconv($params['charset'], 'UTF-8//IGNORE', $data);
+                               return (trim($data) ."\n\n");
+                       } else {
+                               $data = '';
+                       }
+
+                       // $htmlmsg .= $data ."<br><br>";
+                       $charset = $params['charset'];  // assume all parts are same charset
+               }
+
+               // EMBEDDED MESSAGE
+               // Many bounce notifications embed the original message as type 2,
+               // but AOL uses type 1 (multipart), which is not handled here.
+               // There are no PHP functions to parse embedded messages,
+               // so this just appends the raw source to the main message.
+               //      elseif ($p->type==2 && $data) {
+               //              $plainmsg .= $data."\n\n";
+               //      }
+
+               // SUBPART RECURSION
+               if (isset($p->parts) && $p->parts) {
+                       $x = "";
+                       foreach ($p->parts as $partno0 => $p2) {
+                               $x .=  self::messageGetPart($mbox, $uid, $p2, $partno . '.' . ($partno0+1), $subtype);  // 1.2, 1.2.1, etc.
+                               //if ($x) {
+                               //      return $x;
+                               //}
+                       }
+                       return $x;
+               }
+       }
+
+       /**
+        * @param string $in_str  in string
+        * @param string $charset character set
+        * @return string
+        */
+       public static function encodeHeader($in_str, $charset)
+       {
+               $out_str = $in_str;
+               $need_to_convert = false;
+
+               for ($x = 0; $x < strlen($in_str); $x ++) {
+                       if ((ord($in_str[$x]) == 0) || ((ord($in_str[$x]) > 128))) {
+                               $need_to_convert = true;
+                       }
+               }
+
+               if (! $need_to_convert) {
+                       return $in_str;
+               }
+
+               if ($out_str && $charset) {
+                       // define start delimimter, end delimiter and spacer
+                       $end = "?=";
+                       $start = "=?" . $charset . "?B?";
+                       $spacer = $end . "\r\n " . $start;
+
+                       // determine length of encoded text within chunks
+                       // and ensure length is even
+                       $length = 75 - strlen($start) - strlen($end);
+
+                       /*
+                               [EDIT BY danbrown AT php DOT net: The following
+                               is a bugfix provided by (gardan AT gmx DOT de)
+                               on 31-MAR-2005 with the following note:
+                               "This means: $length should not be even,
+                               but divisible by 4. The reason is that in
+                               base64-encoding 3 8-bit-chars are represented
+                               by 4 6-bit-chars. These 4 chars must not be
+                               split between two encoded words, according
+                               to RFC-2047.
+                       */
+                       $length = $length - ($length % 4);
+
+                       // encode the string and split it into chunks
+                       // with spacers after each chunk
+                       $out_str = base64_encode($out_str);
+                       $out_str = chunk_split($out_str, $length, $spacer);
+
+                       // remove trailing spacer and
+                       // add start and end delimiters
+                       $spacer = preg_quote($spacer, '/');
+                       $out_str = preg_replace("/" . $spacer . "$/", "", $out_str);
+                       $out_str = $start . $out_str . $end;
+               }
+               return $out_str;
+       }
+
+       /**
+        * Function send is used by NETWORK_EMAIL and NETWORK_EMAIL2 code
+        * (not to notify the user, but to send items to email contacts)
+        *
+        * @param string $addr    address
+        * @param string $subject subject
+        * @param string $headers headers
+        * @param array  $item    item
+        *
+        * @return void
+        *
+        * @todo This could be changed to use the Emailer class
+        */
+       public static function send($addr, $subject, $headers, $item)
+       {
+               //$headers .= 'MIME-Version: 1.0' . "\n";
+               //$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
+               //$headers .= 'Content-Type: text/plain; charset=UTF-8' . "\n";
+               //$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
+
+               $part = uniqid("", true);
+
+               $html    = prepare_body($item);
+
+               $headers .= "Mime-Version: 1.0\n";
+               $headers .= 'Content-Type: multipart/alternative; boundary="=_'.$part.'"'."\n\n";
+
+               $body = "\n--=_".$part."\n";
+               $body .= "Content-Transfer-Encoding: 8bit\n";
+               $body .= "Content-Type: text/plain; charset=utf-8; format=flowed\n\n";
+
+               $body .= html2plain($html)."\n";
+
+               $body .= "--=_".$part."\n";
+               $body .= "Content-Transfer-Encoding: 8bit\n";
+               $body .= "Content-Type: text/html; charset=utf-8\n\n";
+
+               $body .= '<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">'.$html."</body></html>\n";
+
+               $body .= "--=_".$part."--";
+
+               //$message = '<html><body>' . $html . '</body></html>';
+               //$message = html2plain($html);
+               logger('notifier: email delivery to ' . $addr);
+               mail($addr, $subject, $body, $headers);
+       }
+
+       /**
+        * @param string $iri string
+        * @return string
+        */
+       public static function iri2msgid($iri)
+       {
+               if (!strpos($iri, "@")) {
+                       $msgid = preg_replace("/urn:(\S+):(\S+)\.(\S+):(\d+):(\S+)/i", "urn!$1!$4!$5@$2.$3", $iri);
+               } else {
+                       $msgid = $iri;
+               }
+
+               return($msgid);
+       }
+
+       /**
+        * @param string $msgid msgid
+        * @return string
+        */
+       public static function msgid2iri($msgid)
+       {
+               if (strpos($msgid, "@")) {
+                       $iri = preg_replace("/urn!(\S+)!(\d+)!(\S+)@(\S+)\.(\S+)/i", "urn:$1:$4.$5:$2:$3", $msgid);
+               } else {
+                       $iri = $msgid;
+               }
+               
+               return($iri);
+       }
+}
index 47538faa83953ec13089f06d3d479484f558e850..9a2eaeb5b712767ab9bbf0e50a829d06249858ae 100644 (file)
@@ -151,11 +151,8 @@ class OStatus
 
                // Only update the contacts if it is an OStatus contact
                if ($r && ($r['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
-                       // This contact is vital, so we awake it from the dead
-                       Contact::unmarkForArchival($contact);
 
                        // Update contact data
-
                        $current = $contact;
                        unset($current['name-date']);
 
index feb4dfdc8dbe9aee53b9b6f1d1de20c1ef6d1b76..84bfd4c4f180978940814c4589f000e47def6dd6 100644 (file)
@@ -1343,14 +1343,17 @@ class PortableContact
 
                // Disvover Mastodon servers
                if (!Config::get('system', 'ostatus_disabled')) {
-                       $serverdata = fetch_url("https://instances.mastodon.xyz/instances.json");
-
-                       if ($serverdata) {
-                               $servers = json_decode($serverdata);
-
-                               foreach ($servers as $server) {
-                                       $url = (is_null($server->https_score) ? 'http' : 'https').'://'.$server->name;
-                                       Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $url);
+                       $accesstoken = Config::get('system', 'instances_social_key');
+                       if (!empty($accesstoken)) {
+                               $api = 'https://instances.social/api/1.0/instances/list?count=0';
+                               $header = array('Authorization: Bearer '.$accesstoken);
+                               $serverdata = z_fetch_url($api, false, $redirects, ['headers' => $header]);
+                               if ($serverdata['success']) {
+                                       $servers = json_decode($serverdata['body']);
+                                       foreach ($servers->instances as $server) {
+                                               $url = (is_null($server->https_score) ? 'http' : 'https').'://'.$server->name;
+                                               Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", $url);
+                                       }
                                }
                        }
                }
diff --git a/src/Protocol/Salmon.php b/src/Protocol/Salmon.php
new file mode 100644 (file)
index 0000000..d26a322
--- /dev/null
@@ -0,0 +1,204 @@
+<?php
+/**
+ * @file src/Protocol/Salmon.php
+ */
+namespace Friendica\Protocol;
+
+use Friendica\Network\Probe;
+use Friendica\Util\XML;
+
+require_once 'include/crypto.php';
+
+/**
+ * @brief Salmon Protocol class
+ * The Salmon Protocol is a message exchange protocol running over HTTP designed to decentralize commentary
+ * and annotations made against newsfeed articles such as blog posts.
+ */
+class Salmon
+{
+       /**
+        * @param string $uri     Uniform Resource Identifier
+        * @param string $keyhash encoded key
+        * @return mixed
+        */
+       public static function getKey($uri, $keyhash)
+       {
+               $ret = array();
+
+               logger('Fetching salmon key for '.$uri);
+
+               $arr = Probe::lrdd($uri);
+
+               if (is_array($arr)) {
+                       foreach ($arr as $a) {
+                               if ($a['@attributes']['rel'] === 'magic-public-key') {
+                                       $ret[] = $a['@attributes']['href'];
+                               }
+                       }
+               } else {
+                       return '';
+               }
+
+               // We have found at least one key URL
+               // If it's inline, parse it - otherwise get the key
+
+               if (count($ret) > 0) {
+                       for ($x = 0; $x < count($ret); $x ++) {
+                               if (substr($ret[$x], 0, 5) === 'data:') {
+                                       if (strstr($ret[$x], ',')) {
+                                               $ret[$x] = substr($ret[$x], strpos($ret[$x], ',') + 1);
+                                       } else {
+                                               $ret[$x] = substr($ret[$x], 5);
+                                       }
+                               } elseif (normalise_link($ret[$x]) == 'http://') {
+                                       $ret[$x] = fetch_url($ret[$x]);
+                               }
+                       }
+               }
+
+
+               logger('Key located: ' . print_r($ret, true));
+
+               if (count($ret) == 1) {
+                       // We only found one one key so we don't care if the hash matches.
+                       // If it's the wrong key we'll find out soon enough because
+                       // message verification will fail. This also covers some older
+                       // software which don't supply a keyhash. As long as they only
+                       // have one key we'll be right.
+
+                       return $ret[0];
+               } else {
+                       foreach ($ret as $a) {
+                               $hash = base64url_encode(hash('sha256', $a));
+                               if ($hash == $keyhash) {
+                                       return $a;
+                               }
+                       }
+               }
+
+               return '';
+       }
+
+       /**
+        * @param array  $owner owner
+        * @param string $url   url
+        * @param string $slap  slap
+        * @return integer
+        */
+       public static function slapper($owner, $url, $slap)
+       {
+               // does contact have a salmon endpoint?
+
+               if (! strlen($url)) {
+                       return;
+               }
+
+               if (! $owner['sprvkey']) {
+                       logger(sprintf("user '%s' (%d) does not have a salmon private key. Send failed.",
+                       $owner['username'], $owner['uid']));
+                       return;
+               }
+
+               logger('slapper called for '.$url.'. Data: ' . $slap);
+
+               // create a magic envelope
+
+               $data      = base64url_encode($slap);
+               $data_type = 'application/atom+xml';
+               $encoding  = 'base64url';
+               $algorithm = 'RSA-SHA256';
+               $keyhash   = base64url_encode(hash('sha256', salmon_key($owner['spubkey'])), true);
+
+               $precomputed = '.' . base64url_encode($data_type) . '.' . base64url_encode($encoding) . '.' . base64url_encode($algorithm);
+
+               // GNU Social format
+               $signature   = base64url_encode(rsa_sign($data . $precomputed, $owner['sprvkey']));
+
+               // Compliant format
+               $signature2  = base64url_encode(rsa_sign(str_replace('=', '', $data . $precomputed), $owner['sprvkey']));
+
+               // Old Status.net format
+               $signature3  = base64url_encode(rsa_sign($data, $owner['sprvkey']));
+
+               // At first try the non compliant method that works for GNU Social
+               $xmldata = array("me:env" => array("me:data" => $data,
+                               "@attributes" => array("type" => $data_type),
+                               "me:encoding" => $encoding,
+                               "me:alg" => $algorithm,
+                               "me:sig" => $signature,
+                               "@attributes2" => array("key_id" => $keyhash)));
+
+               $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env");
+
+               $salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
+
+               // slap them
+               post_url($url, $salmon, array(
+                       'Content-type: application/magic-envelope+xml',
+                       'Content-length: ' . strlen($salmon)
+               ));
+
+               $a = get_app();
+               $return_code = $a->get_curl_code();
+
+               // check for success, e.g. 2xx
+
+               if ($return_code > 299) {
+                       logger('GNU Social salmon failed. Falling back to compliant mode');
+
+                       // Now try the compliant mode that normally isn't used for GNU Social
+                       $xmldata = array("me:env" => array("me:data" => $data,
+                                       "@attributes" => array("type" => $data_type),
+                                       "me:encoding" => $encoding,
+                                       "me:alg" => $algorithm,
+                                       "me:sig" => $signature2,
+                                       "@attributes2" => array("key_id" => $keyhash)));
+
+                       $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env");
+
+                       $salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
+
+                       // slap them
+                       post_url($url, $salmon, array(
+                               'Content-type: application/magic-envelope+xml',
+                               'Content-length: ' . strlen($salmon)
+                       ));
+                       $return_code = $a->get_curl_code();
+               }
+
+               if ($return_code > 299) {
+                       logger('compliant salmon failed. Falling back to old status.net');
+
+                       // Last try. This will most likely fail as well.
+                       $xmldata = array("me:env" => array("me:data" => $data,
+                                       "@attributes" => array("type" => $data_type),
+                                       "me:encoding" => $encoding,
+                                       "me:alg" => $algorithm,
+                                       "me:sig" => $signature3,
+                                       "@attributes2" => array("key_id" => $keyhash)));
+
+                       $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env");
+
+                       $salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
+
+                       // slap them
+                       post_url($url, $salmon, array(
+                               'Content-type: application/magic-envelope+xml',
+                               'Content-length: ' . strlen($salmon))
+                       );
+                       $return_code = $a->get_curl_code();
+               }
+
+               logger('slapper for '.$url.' returned ' . $return_code);
+
+               if (! $return_code) {
+                       return -1;
+               }
+
+               if (($return_code == 503) && (stristr($a->get_curl_headers(), 'retry-after'))) {
+                       return -1;
+               }
+
+               return (($return_code >= 200) && ($return_code < 300)) ? 0 : 1;
+       }
+}
index a2be983d6c03cb7ca78645831b5b836639161700..7d4205ac3346ec779a34b90024d9b94a4220dc08 100644 (file)
@@ -5,11 +5,10 @@
 namespace Friendica\Util;
 
 use Friendica\Core\PConfig;
-
-require_once 'include/email.php';
+use Friendica\Protocol\Email;
 
 /**
- * @breif class to handle emailing
+ * @brief class to handle emailing
  */
 class Emailer
 {
@@ -38,8 +37,8 @@ class Emailer
                        $email_textonly = PConfig::get($params['uid'], "system", "email_textonly");
                }
 
-               $fromName = email_header_encode(html_entity_decode($params['fromName'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
-               $messageSubject = email_header_encode(html_entity_decode($params['messageSubject'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
+               $fromName = Email::encodeHeader(html_entity_decode($params['fromName'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
+               $messageSubject = Email::encodeHeader(html_entity_decode($params['messageSubject'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
 
                // generate a mime boundary
                $mimeBoundary   =rand(0, 9)."-"
diff --git a/src/Util/Pidfile.php b/src/Util/Pidfile.php
new file mode 100644 (file)
index 0000000..a5d1171
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * @file src/Util/Pidfile.php
+ */
+namespace Friendica\Util;
+
+/**
+ * @brief Pidfile class
+ */
+class Pidfile
+{
+       private $file;
+       private $running;
+
+       /**
+        * @param string $dir  path
+        * @param string $name filename
+        * @return void
+        */
+       public function __construct($dir, $name)
+       {
+               $this->_file = "$dir/$name.pid";
+
+               if (file_exists($this->_file)) {
+                       $pid = trim(@file_get_contents($this->file));
+                       if (($pid != "") && posix_kill($pid, 0)) {
+                               $this->running = true;
+                       }
+               }
+
+               if (! $this->running) {
+                       $pid = getmypid();
+                       file_put_contents($this->file, $pid);
+               }
+       }
+
+       /**
+        * @return void
+        */
+       public function __destruct()
+       {
+               if ((! $this->running) && file_exists($this->file)) {
+                       @unlink($this->file);
+               }
+       }
+
+       /**
+        * @return boolean
+        */
+       public static function isRunning()
+       {
+               return self::$running;
+       }
+
+       /**
+        * @return object
+        */
+       public static function runningTime()
+       {
+               return time() - @filectime(self::$file);
+       }
+
+       /**
+        * @return boolean
+        */
+       public static function kill()
+       {
+               if (file_exists(self::$file)) {
+                       return posix_kill(file_get_contents(self::$file), SIGTERM);
+               }
+       }
+}
index a5ae466ce3404fae26caa7f661e517a22b675467..db0d518cc3612bd40d71ada7e492a8aab82ed5b6 100644 (file)
@@ -153,115 +153,114 @@ Class Cron {
                        : ''
                );
 
-               $contacts = q("SELECT `contact`.`id` FROM `user`
+               $contacts = q("SELECT `contact`.`id`, `contact`.`nick`, `contact`.`name`, `contact`.`network`, `contact`.`archive`,
+                                       `contact`.`last-update`, `contact`.`priority`, `contact`.`rel`, `contact`.`subhub`
+                               FROM `user`
                                STRAIGHT_JOIN `contact`
-                               ON `contact`.`uid` = `user`.`uid` AND `contact`.`rel` IN (%d, %d) AND `contact`.`poll` != ''
-                                       AND `contact`.`network` IN ('%s', '%s', '%s', '%s', '%s', '%s') $sql_extra
-                                       AND NOT `contact`.`self` AND NOT `contact`.`blocked` AND NOT `contact`.`readonly`
-                                       AND NOT `contact`.`archive`
-                               WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql ORDER BY RAND()",
-                       intval(CONTACT_IS_SHARING),
-                       intval(CONTACT_IS_FRIEND),
+                               ON `contact`.`uid` = `user`.`uid` AND `contact`.`poll` != ''
+                                       AND `contact`.`network` IN ('%s', '%s', '%s', '%s', '%s') $sql_extra
+                                       AND NOT `contact`.`self` AND NOT `contact`.`blocked`
+                               WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql",
                        dbesc(NETWORK_DFRN),
-                       dbesc(NETWORK_ZOT),
                        dbesc(NETWORK_OSTATUS),
+                       dbesc(NETWORK_DIASPORA),
                        dbesc(NETWORK_FEED),
-                       dbesc(NETWORK_MAIL),
-                       dbesc(NETWORK_MAIL2)
+                       dbesc(NETWORK_MAIL)
                );
 
                if (!DBM::is_result($contacts)) {
                        return;
                }
 
-               foreach ($contacts as $c) {
+               foreach ($contacts as $contact) {
 
-                       $res = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
-                               intval($c['id'])
-                       );
+                       if ($manual_id) {
+                               $contact['last-update'] = NULL_DATE;
+                       }
 
-                       if (!DBM::is_result($res)) {
-                               continue;
+                       // Friendica and OStatus are checked once a day
+                       if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS))) {
+                               $contact['priority'] = 2;
                        }
 
-                       foreach ($res as $contact) {
+                       if ($contact['subhub'] && in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS))) {
+                               /*
+                                * We should be getting everything via a hub. But just to be sure, let's check once a day.
+                                * (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
+                                * This also lets us update our subscription to the hub, and add or replace hubs in case it
+                                * changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
+                                */
+                               $poll_interval = Config::get('system', 'pushpoll_frequency');
+                               $contact['priority'] = (!is_null($poll_interval) ? intval($poll_interval) : 3);
+                       }
 
-                               $xml = false;
+                       // Check Diaspora contacts or followers once a week
+                       if (($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == CONTACT_IS_FOLLOWER)) {
+                               $contact['priority'] = 4;
+                       }
 
-                               if ($manual_id) {
-                                       $contact['last-update'] = NULL_DATE;
-                               }
+                       // Check archived contacts once a month
+                       if ($contact['archive']) {
+                               $contact['priority'] = 5;
+                       }
 
-                               if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
-                                       $contact['priority'] = 2;
+                       if (($contact['priority'] >= 0) && !$force) {
+                               $update = false;
+
+                               $t = $contact['last-update'];
+
+                               /*
+                                * Based on $contact['priority'], should we poll this site now? Or later?
+                                */
+                               switch ($contact['priority']) {
+                                       case 5:
+                                               if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 month")) {
+                                                       $update = true;
+                                               }
+                                               break;
+                                       case 4:
+                                               if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 week")) {
+                                                       $update = true;
+                                               }
+                                               break;
+                                       case 3:
+                                               if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 day")) {
+                                                       $update = true;
+                                               }
+                                               break;
+                                       case 2:
+                                               if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 12 hour")) {
+                                                       $update = true;
+                                               }
+                                               break;
+                                       case 1:
+                                               if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
+                                                       $update = true;
+                                               }
+                                               break;
+                                       case 0:
+                                       default:
+                                               if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + ".$min_poll_interval." minute")) {
+                                                       $update = true;
+                                               }
+                                               break;
                                }
-
-                               if ($contact['subhub'] && in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
-                                       /*
-                                        * We should be getting everything via a hub. But just to be sure, let's check once a day.
-                                        * (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
-                                        * This also lets us update our subscription to the hub, and add or replace hubs in case it
-                                        * changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
-                                        */
-                                       $poll_interval = Config::get('system', 'pushpoll_frequency');
-                                       $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
+                               if (!$update) {
+                                       continue;
                                }
+                       }
 
-                               if (($contact['priority'] >= 0) && !$force) {
-                                       $update = false;
-
-                                       $t = $contact['last-update'];
-
-                                       /*
-                                        * Based on $contact['priority'], should we poll this site now? Or later?
-                                        */
-                                       switch ($contact['priority']) {
-                                               case 5:
-                                                       if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 month")) {
-                                                               $update = true;
-                                                       }
-                                                       break;
-                                               case 4:
-                                                       if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 week")) {
-                                                               $update = true;
-                                                       }
-                                                       break;
-                                               case 3:
-                                                       if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 day")) {
-                                                               $update = true;
-                                                       }
-                                                       break;
-                                               case 2:
-                                                       if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 12 hour")) {
-                                                               $update = true;
-                                                       }
-                                                       break;
-                                               case 1:
-                                                       if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
-                                                               $update = true;
-                                                       }
-                                                       break;
-                                               case 0:
-                                               default:
-                                                       if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + ".$min_poll_interval." minute")) {
-                                                               $update = true;
-                                                       }
-                                                       break;
-                                       }
-                                       if (!$update) {
-                                               continue;
-                                       }
-                               }
+                       if (($contact['network'] == NETWORK_FEED) && ($contact['priority'] <= 3)) {
+                               $priority = PRIORITY_MEDIUM;
+                       } elseif ($contact['archive']) {
+                               $priority = PRIORITY_NEGLIGIBLE;
+                       } else {
+                               $priority = PRIORITY_LOW;
+                       }
 
-                               logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact["nick"] . " " . $contact["name"]);
+                       logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
 
-                               if (($contact['network'] == NETWORK_FEED) && ($contact['priority'] <= 3)) {
-                                       $priority = PRIORITY_MEDIUM;
-                               } else {
-                                       $priority = PRIORITY_LOW;
-                               }
-                               Worker::add(array('priority' => $priority, 'dont_fork' => true), 'OnePoll', (int)$contact['id']);
-                       }
+                       Worker::add(array('priority' => $priority, 'dont_fork' => true), 'OnePoll', (int)$contact['id']);
                }
        }
 }
index cbfa86ed88773e9b15e0ca6328a4a3970d3655f9..7df7d030cbd15da10c656e77d946139bb0dcd4b7 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file src/worker/CronJobs.php
  */
@@ -11,25 +12,27 @@ use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Model\GlobalContact;
 use Friendica\Network\Probe;
+use Friendica\Object\Contact;
 use Friendica\Protocol\PortableContact;
 use dba;
 
-class CronJobs {
-       public static function execute($command = ''){
+class CronJobs
+{
+       public static function execute($command = '')
+       {
                global $a;
 
                require_once 'include/datetime.php';
                require_once 'include/post_update.php';
                require_once 'mod/nodeinfo.php';
                require_once 'include/photos.php';
-               require_once 'include/user.php';
 
                // No parameter set? So return
                if ($command == '') {
                        return;
                }
 
-               logger("Starting cronjob ".$command, LOGGER_DEBUG);
+               logger("Starting cronjob " . $command, LOGGER_DEBUG);
 
                // Call possible post update functions
                // see include/post_update.php for more details
@@ -78,7 +81,7 @@ class CronJobs {
                        return;
                }
 
-               logger("Xronjob ".$command." is unknown.", LOGGER_DEBUG);
+               logger("Xronjob " . $command . " is unknown.", LOGGER_DEBUG);
 
                return;
        }
@@ -86,7 +89,8 @@ class CronJobs {
        /**
         * @brief Update the cached values for the number of photo albums per user
         */
-       private static function updatePhotoAlbums() {
+       private static function updatePhotoAlbums()
+       {
                $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`");
                if (!DBM::is_result($r)) {
                        return;
@@ -100,7 +104,8 @@ class CronJobs {
        /**
         * @brief Expire and remove user entries
         */
-       private static function expireAndRemoveUsers() {
+       private static function expireAndRemoveUsers()
+       {
                // expire any expired accounts
                q("UPDATE user SET `account_expired` = 1 where `account_expired` = 0
                        AND `account_expires_on` > '%s'
@@ -120,9 +125,9 @@ class CronJobs {
         *
         * @param App $a
         */
-       private static function clearCache(App $a) {
-
-               $last = Config::get('system','cache_last_cleared');
+       private static function clearCache(App $a)
+       {
+               $last = Config::get('system', 'cache_last_cleared');
 
                if ($last) {
                        $next = $last + (3600); // Once per hour
@@ -142,16 +147,16 @@ class CronJobs {
                clear_cache();
 
                // clear cache for photos
-               clear_cache($a->get_basepath(), $a->get_basepath()."/photo");
+               clear_cache($a->get_basepath(), $a->get_basepath() . "/photo");
 
                // clear smarty cache
-               clear_cache($a->get_basepath()."/view/smarty3/compiled", $a->get_basepath()."/view/smarty3/compiled");
+               clear_cache($a->get_basepath() . "/view/smarty3/compiled", $a->get_basepath() . "/view/smarty3/compiled");
 
                // clear cache for image proxy
                if (!Config::get("system", "proxy_disabled")) {
-                       clear_cache($a->get_basepath(), $a->get_basepath()."/proxy");
+                       clear_cache($a->get_basepath(), $a->get_basepath() . "/proxy");
 
-                       $cachetime = Config::get('system','proxy_cache_time');
+                       $cachetime = Config::get('system', 'proxy_cache_time');
                        if (!$cachetime) {
                                $cachetime = PROXY_DEFAULT_TIME;
                        }
@@ -166,13 +171,13 @@ class CronJobs {
                dba::delete('parsed_url', array("`created` < NOW() - INTERVAL 3 MONTH"));
 
                // Maximum table size in megabyte
-               $max_tablesize = intval(Config::get('system','optimize_max_tablesize')) * 1000000;
+               $max_tablesize = intval(Config::get('system', 'optimize_max_tablesize')) * 1000000;
                if ($max_tablesize == 0) {
                        $max_tablesize = 100 * 1000000; // Default are 100 MB
                }
                if ($max_tablesize > 0) {
                        // Minimum fragmentation level in percent
-                       $fragmentation_level = intval(Config::get('system','optimize_fragmentation')) / 100;
+                       $fragmentation_level = intval(Config::get('system', 'optimize_fragmentation')) / 100;
                        if ($fragmentation_level == 0) {
                                $fragmentation_level = 0.3; // Default value is 30%
                        }
@@ -194,7 +199,7 @@ class CronJobs {
                                // Calculate fragmentation
                                $fragmentation = $table["Data_free"] / ($table["Data_length"] + $table["Index_length"]);
 
-                               logger("Table ".$table["Name"]." - Fragmentation level: ".round($fragmentation * 100, 2), LOGGER_DEBUG);
+                               logger("Table " . $table["Name"] . " - Fragmentation level: " . round($fragmentation * 100, 2), LOGGER_DEBUG);
 
                                // Don't optimize tables that needn't to be optimized
                                if ($fragmentation < $fragmentation_level) {
@@ -202,12 +207,12 @@ class CronJobs {
                                }
 
                                // So optimize it
-                               logger("Optimize Table ".$table["Name"], LOGGER_DEBUG);
+                               logger("Optimize Table " . $table["Name"], LOGGER_DEBUG);
                                q("OPTIMIZE TABLE `%s`", dbesc($table["Name"]));
                        }
                }
 
-               Config::set('system','cache_last_cleared', time());
+               Config::set('system', 'cache_last_cleared', time());
        }
 
        /**
@@ -215,8 +220,8 @@ class CronJobs {
         *
         * @param App $a
         */
-       private static function repairDiaspora(App $a) {
-
+       private static function repairDiaspora(App $a)
+       {
                $starttime = time();
 
                $r = q("SELECT `id`, `url` FROM `contact`
@@ -241,7 +246,7 @@ class CronJobs {
                                continue;
                        }
 
-                       logger("Repair contact ".$contact["id"]." ".$contact["url"], LOGGER_DEBUG);
+                       logger("Repair contact " . $contact["id"] . " " . $contact["url"], LOGGER_DEBUG);
                        q("UPDATE `contact` SET `batch` = '%s', `notify` = '%s', `poll` = '%s', pubkey = '%s' WHERE `id` = %d",
                                dbesc($data["batch"]), dbesc($data["notify"]), dbesc($data["poll"]), dbesc($data["pubkey"]),
                                intval($contact["id"]));
@@ -252,15 +257,15 @@ class CronJobs {
         * @brief Do some repairs in database entries
         *
         */
-       private static function repairDatabase() {
-
+       private static function repairDatabase()
+       {
                // Sometimes there seem to be issues where the "self" contact vanishes.
                // We haven't found the origin of the problem by now.
                $r = q("SELECT `uid` FROM `user` WHERE NOT EXISTS (SELECT `uid` FROM `contact` WHERE `contact`.`uid` = `user`.`uid` AND `contact`.`self`)");
                if (DBM::is_result($r)) {
                        foreach ($r AS $user) {
-                               logger('Create missing self contact for user '.$user['uid']);
-                               user_create_self_contact($user['uid']);
+                               logger('Create missing self contact for user ' . $user['uid']);
+                               Contact::createSelfFromUserId($user['uid']);
                        }
                }
 
index 7030081dc98d5ab17608c2a05c8daf62f91a2330..45a080400ed095325d6deec4ee71014933375f22 100644 (file)
@@ -17,19 +17,26 @@ class DBClean {
                        return;
                }
 
+               if ($stage == 0) {
+                       self::forkCleanProcess();
+               } else {
+                       self::removeOrphans($stage);
+               }
+       }
+
+       /**
+        * @brief Fork the different DBClean processes
+        */
+       private static function forkCleanProcess() {
                // Get the expire days for step 8 and 9
                $days = Config::get('system', 'dbclean-expire-days', 0);
 
-               if ($stage == 0) {
-                       for ($i = 1; $i <= 9; $i++) {
-                               // Execute the background script for a step when it isn't finished.
-                               // Execute step 8 and 9 only when $days is defined.
-                               if (!Config::get('system', 'finished-dbclean-'.$i, false) && (($i < 8) || ($days > 0))) {
-                                       Worker::add(PRIORITY_LOW, 'DBClean', $i);
-                               }
+               for ($i = 1; $i <= 10; $i++) {
+                       // Execute the background script for a step when it isn't finished.
+                       // Execute step 8 and 9 only when $days is defined.
+                       if (!Config::get('system', 'finished-dbclean-'.$i, false) && (($i < 8) || ($i > 9) || ($days > 0))) {
+                               Worker::add(PRIORITY_LOW, 'DBClean', $i);
                        }
-               } else {
-                       self::removeOrphans($stage);
                }
        }
 
@@ -39,17 +46,18 @@ class DBClean {
         *
         * Values for $stage:
         * ------------------
-        * 1:   Old global item entries from item table without user copy.
-        * 2:   Items without parents.
-        * 3:   Orphaned data from thread table.
-        * 4:   Orphaned data from notify table.
-        * 5:   Orphaned data from notify-threads table.
-        * 6:   Orphaned data from sign table.
-        * 7:   Orphaned data from term table.
-        * 8:   Expired threads.
-        * 9:   Old global item entries from expired threads
+        *  1:  Old global item entries from item table without user copy.
+        *  2:  Items without parents.
+        *  3:  Orphaned data from thread table.
+        *  4:  Orphaned data from notify table.
+        *  5:  Orphaned data from notify-threads table.
+        *  6:  Orphaned data from sign table.
+        *  7:  Orphaned data from term table.
+        *  8:  Expired threads.
+        *  9:  Old global item entries from expired threads.
+        * 10:  Old conversations.
         */
-       private static function removeOrphans($stage = 0) {
+       private static function removeOrphans($stage) {
                global $db;
 
                $count = 0;
@@ -75,6 +83,7 @@ class DBClean {
                                        $last_id = $orphan["id"];
                                        dba::delete('item', array('id' => $orphan["id"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 1, $last_id);
                        } else {
                                logger("No global item orphans found");
                        }
@@ -96,6 +105,7 @@ class DBClean {
                                        $last_id = $orphan["id"];
                                        dba::delete('item', array('id' => $orphan["id"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 2, $last_id);
                        } else {
                                logger("No item orphans without parents found");
                        }
@@ -121,6 +131,7 @@ class DBClean {
                                        $last_id = $orphan["iid"];
                                        dba::delete('thread', array('iid' => $orphan["iid"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 3, $last_id);
                        } else {
                                logger("No thread orphans found");
                        }
@@ -146,6 +157,7 @@ class DBClean {
                                        $last_id = $orphan["id"];
                                        dba::delete('notify', array('iid' => $orphan["iid"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 4, $last_id);
                        } else {
                                logger("No notify orphans found");
                        }
@@ -171,6 +183,7 @@ class DBClean {
                                        $last_id = $orphan["id"];
                                        dba::delete('notify-threads', array('id' => $orphan["id"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 5, $last_id);
                        } else {
                                logger("No notify-threads orphans found");
                        }
@@ -196,6 +209,7 @@ class DBClean {
                                        $last_id = $orphan["id"];
                                        dba::delete('sign', array('iid' => $orphan["iid"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 6, $last_id);
                        } else {
                                logger("No sign orphans found");
                        }
@@ -221,6 +235,7 @@ class DBClean {
                                        $last_id = $orphan["tid"];
                                        dba::delete('term', array('oid' => $orphan["oid"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 7, $last_id);
                        } else {
                                logger("No term orphans found");
                        }
@@ -259,6 +274,7 @@ class DBClean {
                                        $last_id = $thread["iid"];
                                        dba::delete('thread', array('iid' => $thread["iid"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 8, $last_id);
                        } else {
                                logger("No expired threads found");
                        }
@@ -286,6 +302,7 @@ class DBClean {
                                        $last_id = $orphan["id"];
                                        dba::delete('item', array('id' => $orphan["id"]));
                                }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 9, $last_id);
                        } else {
                                logger("No global item entries from expired threads");
                        }
@@ -293,11 +310,28 @@ class DBClean {
                        logger("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id);
 
                        Config::set('system', 'dbclean-last-id-9', $last_id);
-               }
+               } elseif ($stage == 10) {
+                       $last_id = Config::get('system', 'dbclean-last-id-10', 0);
+
+                       logger("Deleting old conversations. Last created: ".$last_id);
+                       $r = dba::p("SELECT `received`, `item-uri` FROM `conversation`
+                                       WHERE `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY
+                                       ORDER BY `received` LIMIT ".intval($limit));
+                       $count = dba::num_rows($r);
+                       if ($count > 0) {
+                               logger("found old conversations: ".$count);
+                               while ($orphan = dba::fetch($r)) {
+                                       $last_id = $orphan["received"];
+                                       dba::delete('conversation', array('item-uri' => $orphan["item-uri"]));
+                               }
+                               Worker::add(PRIORITY_MEDIUM, 'DBClean', 10, $last_id);
+                       } else {
+                               logger("No old conversations found");
+                       }
+                       dba::close($r);
+                       logger("Done deleting ".$count." conversations. Last created: ".$last_id);
 
-               // Call it again if not all entries were purged
-               if (($stage != 0) && ($count > 0)) {
-                       Worker::add(PRIORITY_MEDIUM, 'dbclean');
+                       Config::set('system', 'dbclean-last-id-10', $last_id);
                }
        }
 }
index c47e98287b7adeb352afe182d11917430265745c..bb30fc3bf4bef41f477563ea661eeaef735fd48c 100644 (file)
@@ -12,13 +12,13 @@ use Friendica\Database\DBM;
 use Friendica\Object\Contact;
 use Friendica\Protocol\Diaspora;
 use Friendica\Protocol\DFRN;
+use Friendica\Protocol\Email;
 
 require_once 'include/queue_fn.php';
 require_once 'include/html2plain.php';
 require_once 'include/datetime.php';
 require_once 'include/items.php';
 require_once 'include/bbcode.php';
-require_once 'include/email.php';
 
 /// @todo This is some ugly code that needs to be split into several methods
 
@@ -376,7 +376,6 @@ class Delivery {
                                break;
 
                        case NETWORK_MAIL:
-                       case NETWORK_MAIL2:
 
                                if (Config::get('system','dfrn_only')) {
                                        break;
@@ -418,36 +417,36 @@ class Delivery {
                                        if ($r1 && $r1[0]['reply_to'])
                                                $reply_to = $r1[0]['reply_to'];
 
-                                       $subject  = (($it['title']) ? email_header_encode($it['title'],'UTF-8') : t("\x28no subject\x29")) ;
+                                       $subject  = (($it['title']) ? Email::encodeHeader($it['title'],'UTF-8') : t("\x28no subject\x29")) ;
 
                                        // only expose our real email address to true friends
 
                                        if (($contact['rel'] == CONTACT_IS_FRIEND) && !$contact['blocked']) {
                                                if ($reply_to) {
-                                                       $headers  = 'From: '.email_header_encode($local_user[0]['username'],'UTF-8').' <'.$reply_to.'>'."\n";
+                                                       $headers  = 'From: '.Email::encodeHeader($local_user[0]['username'],'UTF-8').' <'.$reply_to.'>'."\n";
                                                        $headers .= 'Sender: '.$local_user[0]['email']."\n";
                                                } else {
-                                                       $headers  = 'From: '.email_header_encode($local_user[0]['username'],'UTF-8').' <'.$local_user[0]['email'].'>'."\n";
+                                                       $headers  = 'From: '.Email::encodeHeader($local_user[0]['username'],'UTF-8').' <'.$local_user[0]['email'].'>'."\n";
                                                }
                                        } else {
-                                               $headers  = 'From: '. email_header_encode($local_user[0]['username'],'UTF-8') .' <'. t('noreply') .'@'.$a->get_hostname() .'>'. "\n";
+                                               $headers  = 'From: '. Email::encodeHeader($local_user[0]['username'],'UTF-8') .' <'. t('noreply') .'@'.$a->get_hostname() .'>'. "\n";
                                        }
 
                                        //if ($reply_to)
                                        //      $headers .= 'Reply-to: '.$reply_to . "\n";
 
-                                       $headers .= 'Message-Id: <'. iri2msgid($it['uri']).'>'. "\n";
+                                       $headers .= 'Message-Id: <'. Email::iri2msgid($it['uri']).'>'. "\n";
 
                                        //logger("Mail: uri: ".$it['uri']." parent-uri ".$it['parent-uri'], LOGGER_DEBUG);
                                        //logger("Mail: Data: ".print_r($it, true), LOGGER_DEBUG);
                                        //logger("Mail: Data: ".print_r($it, true), LOGGER_DATA);
 
                                        if ($it['uri'] !== $it['parent-uri']) {
-                                               $headers .= "References: <".iri2msgid($it["parent-uri"]).">";
+                                               $headers .= "References: <".Email::iri2msgid($it["parent-uri"]).">";
 
                                                // If Threading is enabled, write down the correct parent
                                                if (($it["thr-parent"] != "") && ($it["thr-parent"] != $it["parent-uri"]))
-                                                       $headers .= " <".iri2msgid($it["thr-parent"]).">";
+                                                       $headers .= " <".Email::iri2msgid($it["thr-parent"]).">";
                                                $headers .= "\n";
 
                                                if (!$it['title']) {
@@ -469,7 +468,7 @@ class Delivery {
                                                if (strncasecmp($subject,'RE:',3))
                                                        $subject = 'Re: '.$subject;
                                        }
-                                       email_send($addr, $subject, $headers, $it);
+                                       Email::send($addr, $subject, $headers, $it);
                                }
                                break;
 
index b261b32fc0444b2ecf657026bbbfe2756cbe506f..a3a03055ec9f13040bc289652f5eb4e99cd3a923 100644 (file)
@@ -11,15 +11,14 @@ use Friendica\Network\Probe;
 use Friendica\Object\Contact;
 use Friendica\Protocol\Diaspora;
 use Friendica\Protocol\OStatus;
+use Friendica\Protocol\Salmon;
 use dba;
 
 require_once 'include/queue_fn.php';
 require_once 'include/html2plain.php';
-require_once 'include/salmon.php';
 require_once 'include/datetime.php';
 require_once 'include/items.php';
 require_once 'include/bbcode.php';
-require_once 'include/email.php';
 
 /*
  * This file was at one time responsible for doing all deliveries, but this caused
@@ -448,7 +447,7 @@ class Notifier {
                                // It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
                                $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."')";
                        } else {
-                               $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."', '".NETWORK_DIASPORA."', '".NETWORK_MAIL."', '".NETWORK_MAIL2."')";
+                               $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."', '".NETWORK_DIASPORA."', '".NETWORK_MAIL."')";
                        }
                } else {
                        $public_message = false;
@@ -506,11 +505,11 @@ class Notifier {
                // They are especially used for notifications to OStatus users that don't follow us.
 
                if ($slap && count($url_recipients) && ($public_message || $push_notify) && $normal_mode) {
-                       if (!Config::get('system','dfrn_only')) {
+                       if (!Config::get('system', 'dfrn_only')) {
                                foreach ($url_recipients as $url) {
                                        if ($url) {
                                                logger('notifier: urldelivery: ' . $url);
-                                               $deliver_status = slapper($owner,$url,$slap);
+                                               $deliver_status = Salmon::slapper($owner, $url, $slap);
                                                /// @TODO Redeliver/queue these items on failure, though there is no contact record
                                        }
                                }
@@ -538,9 +537,8 @@ class Notifier {
                        }
 
                        $r2 = q("SELECT `id`, `name`,`network` FROM `contact`
-                               WHERE `network` in ('%s', '%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d",
+                               WHERE `network` in ('%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d",
                                dbesc(NETWORK_DFRN),
-                               dbesc(NETWORK_MAIL2),
                                intval($owner['uid']),
                                intval(CONTACT_IS_SHARING)
                        );
index 356fce4337ff2a708c0c28185a0051b8cae39f4c..1190c77f5fc3e5a4db7fdeaed134accba2fc7896 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 use Friendica\Object\Contact;
+use Friendica\Protocol\Email;
 use Friendica\Protocol\PortableContact;
 use dba;
 
@@ -20,10 +21,9 @@ Class OnePoll
 
                require_once 'include/datetime.php';
                require_once 'include/items.php';
-               require_once 'include/email.php';
                require_once 'include/queue_fn.php';
 
-               logger('onepoll: start');
+               logger('start');
 
                $manual_id  = 0;
                $generation = 0;
@@ -36,36 +36,18 @@ Class OnePoll
                }
 
                if (!$contact_id) {
-                       logger('onepoll: no contact');
+                       logger('no contact');
                        return;
                }
 
                $d = datetime_convert();
 
-               // Only poll from those with suitable relationships,
-               // and which have a polling address and ignore Diaspora since
-               // we are unable to match those posts with a Diaspora GUID and prevent duplicates.
-
-               $contacts = q("SELECT `contact`.* FROM `contact`
-                       WHERE (`rel` = %d OR `rel` = %d) AND `poll` != ''
-                       AND NOT `network` IN ('%s', '%s')
-                       AND `contact`.`id` = %d
-                       AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0
-                       AND `contact`.`archive` = 0 LIMIT 1",
-                       intval(CONTACT_IS_SHARING),
-                       intval(CONTACT_IS_FRIEND),
-                       dbesc(NETWORK_FACEBOOK),
-                       dbesc(NETWORK_PUMPIO),
-                       intval($contact_id)
-               );
-
-               if (!count($contacts)) {
+               $contact = dba::select('contact', [], ['id' => $contact_id], ['limit' => 1]);
+               if (!DBM::is_result($contact)) {
                        logger('Contact not found or cannot be used.');
                        return;
                }
 
-               $contact = $contacts[0];
-
                $importer_uid = $contact['uid'];
 
                // load current friends if possible.
@@ -81,18 +63,25 @@ Class OnePoll
                        }
                }
 
-               /// @TODO Check why we don't poll the Diaspora feed at the moment (some guid problem in the items?)
-               /// @TODO Check whether this is possible with Redmatrix
-               if ($contact["network"] == NETWORK_DIASPORA) {
-                       if (PortableContact::updateNeeded($contact["created"], $contact["last-item"], $contact["failure_update"], $contact["success_update"])) {
-                               $last_updated = PortableContact::lastUpdated($contact["url"]);
-                               $updated = datetime_convert();
-                               if ($last_updated) {
-                                       $fields = array('last-item' => $last_updated, 'last-update' => $updated, 'success_update' => $updated);
-                                       dba::update('contact', $fields, array('id' => $contact['id']));
-                               } else {
-                                       dba::update('contact', array('last-update' => $updated, 'failure_update' => $updated), array('id' => $contact['id']));
+               // Diaspora users, archived users and followers are only checked if they still exist.
+               if ($contact['archive'] || ($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == CONTACT_IS_FOLLOWER)) {
+                       $last_updated = PortableContact::lastUpdated($contact["url"]);
+                       $updated = datetime_convert();
+                       if ($last_updated) {
+                               logger('Contact '.$contact['id'].' had last update on '.$last_updated, LOGGER_DEBUG);
+
+                               // The last public item can be older than the last item we got
+                               if ($last_updated < $contact['last-item']) {
+                                       $last_updated = $contact['last-item'];
                                }
+
+                               $fields = array('last-item' => $last_updated, 'last-update' => $updated, 'success_update' => $updated);
+                               self::updateContact($contact, $fields);
+                               Contact::unmarkForArchival($contact);
+                       } else {
+                               self::updateContact($contact, array('last-update' => $updated, 'failure_update' => $updated));
+                               Contact::markForArchival($contact);
+                               logger('Contact '.$contact['id'].' is marked for archival', LOGGER_DEBUG);
                        }
                        return;
                }
@@ -102,8 +91,8 @@ Class OnePoll
                $t = $contact['last-update'];
 
                if ($contact['subhub']) {
-                       $poll_interval = Config::get('system', 'pushpoll_frequency');
-                       $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
+                       $poll_interval = Config::get('system', 'pushpoll_frequency', 3);
+                       $contact['priority'] = intval($poll_interval);
                        $hub_update = false;
 
                        if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 day")) {
@@ -122,12 +111,18 @@ Class OnePoll
                if (($contact['network'] === NETWORK_OSTATUS) || ($contact['network'] === NETWORK_DIASPORA) || ($contact['network'] === NETWORK_DFRN)) {
                        if (!PortableContact::reachable($contact['url'])) {
                                logger("Skipping probably dead contact ".$contact['url']);
+
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
                                return;
                        }
 
                        if (!update_contact($contact["id"])) {
                                Contact::markForArchival($contact);
                                logger('Contact is marked dead');
+
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
                                return;
                        } else {
                                Contact::unmarkForArchival($contact);
@@ -136,6 +131,9 @@ Class OnePoll
 
                if ($importer_uid == 0) {
                        logger('Ignore public contacts');
+
+                       // set the last-update so we don't keep polling
+                       dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
                        return;
                }
 
@@ -145,12 +143,15 @@ Class OnePoll
 
                if (!DBM::is_result($r)) {
                        logger('No self contact for user '.$importer_uid);
+
+                       // set the last-update so we don't keep polling
+                       dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
                        return;
                }
 
                $importer = $r[0];
 
-               logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
+               logger("poll: ({$contact['network']}-{$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
 
                if ($contact['network'] === NETWORK_DFRN) {
                        $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
@@ -179,6 +180,9 @@ Class OnePoll
                        $ret = z_fetch_url($url);
 
                        if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
+                               Contact::markForArchival($contact);
                                return;
                        }
 
@@ -186,7 +190,7 @@ Class OnePoll
 
                        $html_code = $a->get_curl_code();
 
-                       logger('onepoll: handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
+                       logger('handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
 
 
                        if (!strlen($handshake_xml) || ($html_code >= 400) || !$html_code) {
@@ -200,8 +204,7 @@ Class OnePoll
 
                                // set the last-update so we don't keep polling
                                $fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
-                               dba::update('contact', $fields, array('id' => $contact['id']));
-
+                               self::updateContact($contact, $fields);
                                return;
                        }
 
@@ -211,8 +214,7 @@ Class OnePoll
                                Contact::markForArchival($contact);
 
                                $fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
-                               dba::update('contact', $fields, array('id' => $contact['id']));
-
+                               self::updateContact($contact, $fields);
                                return;
                        }
 
@@ -225,7 +227,7 @@ Class OnePoll
                                // we may not be friends anymore. Will keep trying for one month.
                                // set the last-update so we don't keep polling
                                $fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
-                               dba::update('contact', $fields, array('id' => $contact['id']));
+                               self::updateContact($contact, $fields);
 
                                Contact::markForArchival($contact);
                        } elseif ($contact['term-date'] > NULL_DATE) {
@@ -234,6 +236,8 @@ Class OnePoll
                        }
 
                        if ((intval($res->status) != 0) || !strlen($res->challenge) || !strlen($res->dfrn_id)) {
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
                                return;
                        }
 
@@ -264,8 +268,12 @@ Class OnePoll
                        }
 
                        if ($final_dfrn_id != $orig_id) {
-                               logger('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
                                // did not decode properly - cannot trust this site
+                               logger('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
+
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
+                               Contact::markForArchival($contact);
                                return;
                        }
 
@@ -298,25 +306,33 @@ Class OnePoll
                        // Are we allowed to import from this person?
 
                        if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) {
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
                                return;
                        }
 
                        $cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
                        $ret = z_fetch_url($contact['poll'], false, $redirects, array('cookiejar' => $cookiejar));
+                       unlink($cookiejar);
 
                        if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
+                               Contact::markForArchival($contact);
                                return;
                        }
 
                        $xml = $ret['body'];
 
-                       unlink($cookiejar);
-               } elseif ($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) {
+               } elseif ($contact['network'] === NETWORK_MAIL) {
 
                        logger("Mail: Fetching for ".$contact['addr'], LOGGER_DEBUG);
 
                        $mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
                        if ($mail_disabled) {
+                               // set the last-update so we don't keep polling
+                               dba::update('contact', ['last-update' => datetime_convert()], ['id' => $contact['id']]);
+                               Contact::markForArchival($contact);
                                return;
                        }
 
@@ -328,10 +344,10 @@ Class OnePoll
                        $condition = array("`server` != '' AND `uid` = ?", $importer_uid);
                        $mailconf = dba::select('mailacct', array(), $condition, array('limit' => 1));
                        if (DBM::is_result($x) && DBM::is_result($mailconf)) {
-                               $mailbox = construct_mailbox_name($mailconf);
+                               $mailbox = Email::constructMailboxName($mailconf);
                                $password = '';
                                openssl_private_decrypt(hex2bin($mailconf['pass']), $password, $x['prvkey']);
-                               $mbox = email_connect($mailbox, $mailconf['user'], $password);
+                               $mbox = Email::connect($mailbox, $mailconf['user'], $password);
                                unset($password);
                                logger("Mail: Connect to " . $mailconf['user']);
                                if ($mbox) {
@@ -344,14 +360,14 @@ Class OnePoll
                        }
 
                        if ($mbox) {
-                               $msgs = email_poll($mbox, $contact['addr']);
+                               $msgs = Email::poll($mbox, $contact['addr']);
 
                                if (count($msgs)) {
                                        logger("Mail: Parsing ".count($msgs)." mails from ".$contact['addr']." for ".$mailconf['user'], LOGGER_DEBUG);
 
-                                       $metas = email_msg_meta($mbox,implode(',', $msgs));
+                                       $metas = Email::messageMeta($mbox, implode(',', $msgs));
                                        if (count($metas) != count($msgs)) {
-                                               logger("onepoll: for " . $mailconf['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG);
+                                               logger("for " . $mailconf['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG);
                                        } else {
                                                $msgs = array_combine($msgs, $metas);
 
@@ -361,10 +377,9 @@ Class OnePoll
                                                        $datarray = array();
                                                        $datarray['verb'] = ACTIVITY_POST;
                                                        $datarray['object-type'] = ACTIVITY_OBJ_NOTE;
-               //                                      $meta = email_msg_meta($mbox, $msg_uid);
-               //                                      $headers = email_msg_headers($mbox, $msg_uid);
+                                                       // $meta = Email::messageMeta($mbox, $msg_uid);
 
-                                                       $datarray['uri'] = msgid2iri(trim($meta->message_id, '<>'));
+                                                       $datarray['uri'] = Email::msgid2iri(trim($meta->message_id, '<>'));
 
                                                        // Have we seen it before?
                                                        $fields = array('deleted', 'id');
@@ -416,7 +431,7 @@ Class OnePoll
                                                                $refs_arr = explode(' ', $raw_refs);
                                                                if (count($refs_arr)) {
                                                                        for ($x = 0; $x < count($refs_arr); $x ++) {
-                                                                               $refs_arr[$x] = "'" . msgid2iri(str_replace(array('<', '>', ' '),array('', '', ''),dbesc($refs_arr[$x]))) . "'";
+                                                                               $refs_arr[$x] = "'" . Email::msgid2iri(str_replace(array('<', '>', ' '),array('', '', ''),dbesc($refs_arr[$x]))) . "'";
                                                                        }
                                                                }
                                                                $qstr = implode(',', $refs_arr);
@@ -466,7 +481,7 @@ Class OnePoll
                                                                $datarray['parent-uri'] = $datarray['uri'];
                                                        }
 
-                                                       $r = email_get_msg($mbox, $msg_uid, $reply);
+                                                       $r = Email::getMessage($mbox, $msg_uid, $reply);
                                                        if (!$r) {
                                                                logger("Mail: can't fetch msg ".$msg_uid." for ".$mailconf['user']);
                                                                continue;
@@ -560,8 +575,8 @@ Class OnePoll
                                logger('post_handshake: response from ' . $url . ' did not contain XML.');
 
                                $fields = array('last-update' => datetime_convert(), 'failure_update' => datetime_convert());
-                               dba::update('contact', $fields, array('id' => $contact['id']));
-
+                               self::updateContact($contact, $fields);
+                               Contact::markForArchival($contact);
                                return;
                        }
 
@@ -605,13 +620,15 @@ Class OnePoll
 
                        $updated = datetime_convert();
 
-                       dba::update('contact', array('last-update' => $updated, 'success_update' => $updated), array('id' => $contact['id']));
+                       self::updateContact($contact, array('last-update' => $updated, 'success_update' => $updated));
                        dba::update('gcontact', array('last_contact' => $updated), array('nurl' => $contact['nurl']));
+                       Contact::unmarkForArchival($contact);
                } elseif (in_array($contact["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED))) {
                        $updated = datetime_convert();
 
-                       dba::update('contact', array('last-update' => $updated, 'failure_update' => $updated), array('id' => $contact['id']));
+                       self::updateContact($contact, array('last-update' => $updated, 'failure_update' => $updated));
                        dba::update('gcontact', array('last_failure' => $updated), array('nurl' => $contact['nurl']));
+                       Contact::markForArchival($contact);
                } else {
                        dba::update('contact', array('last-update' => $updated), array('id' => $contact['id']));
                }
@@ -626,4 +643,15 @@ Class OnePoll
 
                return $subject;
        }
+
+       /**
+        * @brief Updates a personal contact entry and the public contact entry
+        *
+        * @param array $contact The personal contact entry
+        * @param array $fields The fields that are updated
+        */
+       private static function updateContact($contact, $fields) {
+               dba::update('contact', $fields, array('id' => $contact['id']));
+               dba::update('contact', $fields, array('uid' => 0, 'nurl' => $contact['nurl']));
+       }
 }
index 47f1c8044b0b50039f7681989e086feff31b3142..cb00addc9497d823bbdd0f55094f7a924d6bcea6 100644 (file)
@@ -1,9 +1,7 @@
 <?php
-
 /**
  * @file src/Worker/Queue.php
  */
-
 namespace Friendica\Worker;
 
 use Friendica\Core\Cache;
@@ -13,13 +11,13 @@ use Friendica\Database\DBM;
 use Friendica\Protocol\Diaspora;
 use Friendica\Protocol\DFRN;
 use Friendica\Protocol\PortableContact;
+use Friendica\Protocol\Salmon;
 use dba;
 
 require_once 'include/queue_fn.php';
 require_once 'include/datetime.php';
 require_once 'include/items.php';
 require_once 'include/bbcode.php';
-require_once 'include/salmon.php';
 
 class Queue
 {
@@ -141,7 +139,7 @@ class Queue
                        case NETWORK_OSTATUS:
                                if ($contact['notify']) {
                                        logger('queue: slapdelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
-                                       $deliver_status = slapper($owner, $contact['notify'], $data);
+                                       $deliver_status = Salmon::slapper($owner, $contact['notify'], $data);
 
                                        if ($deliver_status == (-1)) {
                                                update_queue_time($q_item['id']);
index ba0867d3a8ca3cfd7c423c25c4486b2df41ecbcd..12a04995c93cb6b5c1ac3bc7c408774dc461ca6b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define('UPDATE_VERSION' , 1235);
+define('UPDATE_VERSION' , 1236);
 
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
@@ -1472,9 +1472,6 @@ function update_1164() {
        $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
                NETWORK_DFRN, NETWORK_DFRN);
 
-       $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
-               NETWORK_ZOT, NETWORK_ZOT);
-
        $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
                NETWORK_OSTATUS, NETWORK_OSTATUS);
 
@@ -1487,9 +1484,6 @@ function update_1164() {
        $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
                NETWORK_MAIL, NETWORK_MAIL);
 
-       $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
-               NETWORK_MAIL2, NETWORK_MAIL2);
-
        $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
                NETWORK_FACEBOOK, NETWORK_FACEBOOK);
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index cb6789e45c455779a1f0b442ad0b92147d468010..ab586b651017c5ec0acc08a9838b0c187c5dc4b7 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/env php
 <?php
-
 /**
  * @brief tool to block an account from the node
  *
  * Author: Tobias Diekershoff
  *
  * License: AGPLv3 or later, same as Friendica
- **/
-
+ */
 if ($argc != 2 || $argv[1] == "-h" || $argv[1] == "--help" || $argv[1] == "-?") {
-       echo "Usage: ".$argv[0]." [-h|profile_url]\r\n";
+       echo "Usage: " . $argv[0] . " [-h|profile_url]\r\n";
        echo "    -h, -?, --help ... show this help\r\n";
        echo "    profile_url ...... The URL of the profile you want to silence\r\n";
        echo "\r\n";
        echo "Example: block bob@example.com\r\n";
-       echo "$> ".$argv[0]." https://example.com/profiles/bob\r\n";
+       echo "$> " . $argv[0] . " https://example.com/profiles/bob\r\n";
        echo "\r\n";
        exit(0);
 }
 
-use Friendica\Database\DBM;
-use Friendica\Network\Probe;
+use Friendica\BaseObject;
+use Friendica\Object\Contact;
 
 require_once 'boot.php';
 require_once 'include/dba.php';
 require_once 'include/text.php';
-$a = get_app();
-require_once '.htconfig.php';
 
+$a = get_app();;
+BaseObject::setApp($a);
+
+require_once '.htconfig.php';
 dba::connect($db_host, $db_user, $db_pass, $db_data);
 unset($db_host, $db_user, $db_pass, $db_data);
 
-/**
- * 1. make nurl from last parameter
- * 2. check DB (contact) if there is a contact with uid=0 and that nurl, get the ID
- * 3. set the flag hidden=1 for the contact entry with the found ID
- **/
-$net = Probe::uri($argv[1]);
-if (in_array($net['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
-       echo 'This account seems not to exist.';
+$contact_id = Contact::getIdForURL($argv[1], 0);
+if (!$contact_id) {
+       echo t('Could not find any contact entry for this URL (%s)', $nurl);
        echo "\r\n";
        exit(1);
 }
-$nurl = normalise_link($net['url']);
-$r = dba::select('contact', array('id'), array('nurl' => $nurl, 'uid' => 0), array('limit' => 1));
-if (DBM::is_result($r)) {
-       dba::update('contact', array('blocked' => true), array('id' => $r['id']));
-       echo "NOTICE: The account should be blocked from the node now\r\n";
-} else {
-       echo "NOTICE: Could not find any entry for this URL (".$nurl.")\r\n";
-}
-
-?>
+Contact::block($contact_id);
+echo t('The contact has been blocked from the node');
+echo "\r\n";
+exit(0);
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/view/templates/admin/aside.tpl b/view/templates/admin/aside.tpl
new file mode 100644 (file)
index 0000000..5c9cce0
--- /dev/null
@@ -0,0 +1,47 @@
+<script>
+       // update pending count //
+       $(function(){
+
+               $("nav").bind('nav-update',  function(e,data){
+                       var elm = $('#pending-update');
+                       var register = $(data).find('register').text();
+                       if (register=="0") { register=""; elm.hide();} else { elm.show(); }
+                       elm.html(register);
+               });
+       });
+</script>
+
+<h4><a href="{{$admurl}}">{{$admtxt}}</a></h4>
+<ul class='admin linklist'>
+{{foreach $subpages as $page}}
+       <li class='admin link button {{$page.2}}'><a href='{{$page.0}}'>{{$page.1}}</a></li>
+{{/foreach}}
+</ul>
+
+{{if $admin.update}}
+<ul class='admin linklist'>
+       <li class='admin link button {{$admin.update.2}}'><a href='{{$admin.update.0}}'>{{$admin.update.1}}</a></li>
+       <li class='admin link button {{$admin.update.2}}'><a href='https://kakste.com/profile/inthegit'>Important Changes</a></li>
+</ul>
+{{/if}}
+
+
+{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
+<ul class='admin linklist'>
+       {{foreach $admin.plugins_admin as $l}}
+       <li class='admin link button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
+       {{/foreach}}
+</ul>
+       
+       
+<h4>{{$logtxt}}</h4>
+<ul class='admin linklist'>
+       <li class='admin link button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
+       <li class='admin link button {{$admin.viewlogs.2}}'><a href='{{$admin.viewlogs.0}}'>{{$admin.viewlogs.1}}</a></li>
+</ul>
+
+<h4>{{$diagnosticstxt}}</h4>
+<ul class='admin linklist'>
+       <li class='admin link {{$admin.diagnostics_probe.2}}'><a href="{{$admin.diagnostics_probe.0}}">{{$admin.diagnostics_probe.1}}</a></li>
+       <li class='admin link {{$admin.diagnostics_webfinger.2}}'><a href="{{$admin.diagnostics_webfinger.0}}">{{$admin.diagnostics_webfinger.1}}</a></li>
+</ul>
diff --git a/view/templates/admin/blocklist.tpl b/view/templates/admin/blocklist.tpl
new file mode 100644 (file)
index 0000000..1484c98
--- /dev/null
@@ -0,0 +1,33 @@
+<script>
+       function confirm_delete(uname){
+               return confirm("{{$confirm_delete}}".format(uname));
+       }
+</script>
+<div id="adminpage">
+       <h1>{{$title}} - {{$page}}</h1>
+       <p>{{$intro}}</p>
+       <p>{{$public}}</p>
+
+       <h2>{{$addtitle}}</h2>
+       <form action="{{$baseurl}}/admin/blocklist" method="post">
+               <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+               {{include file="field_input.tpl" field=$newdomain}}
+               {{include file="field_input.tpl" field=$newreason}}
+               <div class="submit"><input type="submit" name="page_blocklist_save" value="{{$submit}}" /></div>
+       </form>
+
+       {{if $entries}}
+       <h2>{{$currenttitle}}</h2>
+       <p>{{$currentintro}}</p>
+       <form action="{{$baseurl}}/admin/blocklist" method="post">
+               <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+               {{foreach $entries as $e}}
+                       {{include file="field_input.tpl" field=$e.domain}}
+                       {{include file="field_input.tpl" field=$e.reason}}
+                       {{include file="field_checkbox.tpl" field=$e.delete}}
+               {{/foreach}}
+               <div class="submit"><input type="submit" name="page_blocklist_edit" value="{{$savechanges}}" /></div>
+               {{/if}}
+       </form>
+
+</div>
diff --git a/view/templates/admin/contactblock.tpl b/view/templates/admin/contactblock.tpl
new file mode 100644 (file)
index 0000000..152550f
--- /dev/null
@@ -0,0 +1,63 @@
+<script>
+       function selectall(cls) {
+               $('.' + cls).prop('checked', true);
+               return false;
+       }
+       function selectnone(cls) {
+               $('.' + cls).prop('checked', false);
+               return false;
+       }
+</script>
+<div id="adminpage">
+       <h1>{{$title}} - {{$page}}</h1>
+       <p>{{$description}}</p>
+       <form action="{{$baseurl}}/admin/contactblock" method="post">
+        <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+
+               <h3>{{$h_contacts}}</h3>
+       {{if $contacts}}
+               <table id="contactblock">
+                       <thead>
+                               <tr>
+                                       <th></th>
+                                               {{foreach $th_contacts as $th}}
+                                       <th>
+                                               {{$th}}
+                                       </th>
+                                       {{/foreach}}
+                                       <th></th>
+                               </tr>
+                       </thead>
+                       <tbody>
+                               {{foreach $contacts as $contact}}
+                               <tr>
+                                       <td class="checkbox"><input type="checkbox" class="contacts_ckbx" id="id_contact_{{$contact.id}}" name="contacts[]" value="{{$contact.id}}"/></td>
+                                       <td><img class="icon" src="{{$contact.micro}}" alt="{{$contact.nickname}}" title="{{$contact.nickname}}"></td>
+                                       <td class="name">{{$contact.name}}</td>
+                                       <td class="addr">{{$contact.addr}}</td>
+                                       <td class="addr"><a href="{{$contact.url}}" title="{{$contact.nickname}}" >{{$contact.url}}</a></td>
+                               </tr>
+                               {{/foreach}}
+                       </tbody>
+               </table>
+               <p><a href="#" onclick="return selectall('contacts_ckbx');">{{$select_all}}</a> | <a href="#" onclick="return selectnone('contacts_ckbx');">{{$select_none}}</a></p>
+               {{$paginate}}
+               <div class="submit"><input type="submit" name="page_contactblock_unblock" value="{{$unblock|escape:'html'}}" /></div>
+       {{else}}
+               <p>{{$no_data|escape:'html'}}</p>
+       {{/if}}
+       </form>
+
+       <h3>{{$h_newblock}}</h3>
+       <form action="{{$baseurl}}/admin/contactblock" method="post">
+               <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+               <table id="contactblock">
+                       <tbody>
+                               <tr>
+                                       <td>{{include file="field_input.tpl" field=$contacturl}}</td>
+                               </tr>
+                       </tbody>
+               </table>
+               <div class="submit"><input type="submit" name="page_contactblock_block" value="{{$submit|escape:'html'}}" /></div>
+       </form>
+</div>
diff --git a/view/templates/admin/deleteitem.tpl b/view/templates/admin/deleteitem.tpl
new file mode 100644 (file)
index 0000000..cf819de
--- /dev/null
@@ -0,0 +1,11 @@
+<div id="adminpage">
+       <h1>{{$title}} - {{$page}}</h1>
+       <p>{{$intro1}}</p>
+       <p>{{$intro2}}</p>
+</div>
+
+<form action="{{$baseurl}}/admin/deleteitem" method="post">
+       <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+       {{include file="field_input.tpl" field=$deleteitemguid}}
+       <div class="submit"><input type="submit" name="page_deleteitem_submit" value="{{$submit}}" /></div>
+</form>
diff --git a/view/templates/admin/federation.tpl b/view/templates/admin/federation.tpl
new file mode 100644 (file)
index 0000000..ee33df0
--- /dev/null
@@ -0,0 +1,58 @@
+<script src="{{$baseurl}}/library/Chart.js-1.0.2/Chart.min.js"></script>
+<canvas id="FederationChart" class="federation-graph"></canvas>
+<div id="adminpage">
+    <h1>{{$title}} - {{$page}}</h1>
+    <p>{{$intro}}</p>
+    {{if not $autoactive}}
+       <p class="error-message">{{$hint}}</p>
+    {{/if}}
+    <p>{{$legendtext}}
+    <ul>
+    {{foreach $counts as $c}}
+       {{if $c[0]['total'] > 0}}
+           <li>{{$c[0]['platform']}} ({{$c[0]['total']}})</li>
+       {{/if}}
+    {{/foreach}}
+    </ul>
+    </p>
+</div>
+<script>
+var FedData = [
+{{foreach $counts as $c}}
+    { value: {{$c[0]['total']}}, label: "{{$c[0]['platform']}}", color: '{{$c[3]}}', highlight: "#EE90A1", },
+{{/foreach}}
+];
+var ctx = document.getElementById("FederationChart").getContext("2d");
+var myDoughnutChart = new Chart(ctx).Doughnut(FedData, { animateRotate : false, });
+</script>
+
+<table id="federation-stats">
+{{foreach $counts as $c}}
+    {{if $c[0]['total'] > 0}}
+    <tr>
+           <th>{{$c[0]['platform']}}</th>
+           <th><strong>{{$c[0]['total']}}</strong></td>
+           <td>{{$c[0]['network']}}</td>
+    </tr>
+    <tr>
+    <td colspan="3" class="federation-data">
+    <canvas id="{{$c[2]}}Chart" class="federation-network-graph"></canvas>
+    <script>
+    var {{$c[2]}}data = [
+    {{foreach $c[1] as $v}}
+       { value: {{$v['total']}}, label: '{{$v['version']}}', color: "{{$c[3]}}", highlight: "#EE90A1",},
+    {{/foreach}}
+    ];
+    var ctx = document.getElementById("{{$c[2]}}Chart").getContext("2d");
+    var my{{$c[2]}}DoughnutChart = new Chart(ctx).Doughnut({{$c[2]}}data, {animateRotate : false,});
+    </script>
+    <ul class="federation-stats">
+    {{foreach $c[1] as $v}}
+       <li>{{if ($c[0]['platform']==='Friendica' and  $version===$v['version']) }}<span class="version-match">{{$v['version']}}</span>{{else}}{{$v['version']}}{{/if}} ({{$v['total']}})</li>
+    {{/foreach}}
+    </ul>
+    </td>
+    </tr>
+    {{/if}}
+{{/foreach}}
+</table>
diff --git a/view/templates/admin/logs.tpl b/view/templates/admin/logs.tpl
new file mode 100644 (file)
index 0000000..b2e6357
--- /dev/null
@@ -0,0 +1,22 @@
+<div id='adminpage'>
+    <h1>{{$title}} - {{$page}}</h1>
+       
+       <form action="{{$baseurl}}/admin/logs" method="post">
+           <input type='hidden' name='form_security_token' value="{{$form_security_token|escape:'html'}}">
+
+           {{include file="field_checkbox.tpl" field=$debugging}}
+           {{include file="field_input.tpl" field=$logfile}}
+           {{include file="field_select.tpl" field=$loglevel}}
+       
+           <div class="submit"><input type="submit" name="page_logs" value="{{$submit|escape:'html'}}" /></div>
+       
+       </form>
+
+       <h2>{{$phpheader}}</h2>
+       <div>
+               <p>{{$phplogenabled}}<p>
+               <p>{{$phphint}}</p>
+               <pre>{{$phplogcode}}</pre>
+       </div>
+       
+</div>
diff --git a/view/templates/admin/plugins.tpl b/view/templates/admin/plugins.tpl
new file mode 100644 (file)
index 0000000..75565dd
--- /dev/null
@@ -0,0 +1,22 @@
+
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+               {{if $pcount eq 0}}
+                   <div class="error-message">
+                   {{$noplugshint}}
+                   </div>
+               {{else}}
+               <a class="btn" href="{{$baseurl}}/admin/{{$function}}?a=r&amp;t={{$form_security_token}}">{{$reload}}</a>
+               <ul id='pluginslist'>
+               {{foreach $plugins as $p}}
+                       <li class='plugin {{$p.1}}'>
+                               <a class='toggleplugin' href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}?a=t&amp;t={{$form_security_token}}' title="{{if $p.1==on}}Disable{{else}}Enable{{/if}}" ><span class='icon {{$p.1}}'></span></a>
+                               <a href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}'><span class='name'>{{$p.2.name}}</span></a> - <span class="version">{{$p.2.version}}</span>
+                               {{if $p.2.experimental}} {{$experimental}} {{/if}}{{if $p.2.unsupported}} {{$unsupported}} {{/if}}
+
+                                       <div class='desc'>{{$p.2.description}}</div>
+                       </li>
+               {{/foreach}}
+               </ul>
+               {{/if}}
+</div>
diff --git a/view/templates/admin/plugins_details.tpl b/view/templates/admin/plugins_details.tpl
new file mode 100644 (file)
index 0000000..9def8fc
--- /dev/null
@@ -0,0 +1,37 @@
+
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <p><span class='toggleplugin icon {{$status}}'></span> {{$info.name}} - {{$info.version}} : <a href="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/?a=t&amp;t={{$form_security_token}}">{{$action}}</a></p>
+       <p>{{$info.description}}</p>
+       
+       <p class="author">{{$str_author}}
+       {{foreach $info.author as $a}}
+               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
+       {{/foreach}}
+       </p>
+
+       <p class="maintainer">{{$str_maintainer}}
+       {{foreach $info.maintainer as $a}}
+               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
+       {{/foreach}}
+       </p>
+       
+       {{if $screenshot}}
+       <a href="{{$screenshot.0}}" class='screenshot'><img src="{{$screenshot.0}}" alt="{{$screenshot.1}}" /></a>
+       {{/if}}
+
+       {{if $admin_form}}
+       <h3>{{$settings}}</h3>
+       <form method="post" action="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/">
+               {{$admin_form}}
+       </form>
+       {{/if}}
+
+       {{if $readme}}
+       <h3>Readme</h3>
+       <div id="plugin_readme">
+               {{$readme}}
+       </div>
+       {{/if}}
+</div>
diff --git a/view/templates/admin/queue.tpl b/view/templates/admin/queue.tpl
new file mode 100644 (file)
index 0000000..aaca9b0
--- /dev/null
@@ -0,0 +1,25 @@
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}} ({{$count}})</h1>
+       
+       <p>{{$info}}</p>
+       <table>
+               <tr>
+                       <th>{{$id_header}}</th>
+                       <th>{{$to_header}}</th>
+                       <th>{{$url_header}}</th>
+                       <th>{{$network_header}}</th>
+                       <th>{{$created_header}}</th>
+                       <th>{{$last_header}}</th>
+               </tr>
+               {{foreach $entries as $e}}
+               <tr>
+                       <td>{{$e.id}}</td>
+                       <td>{{$e.name}}</td>
+                       <td><a href="{{$e.nurl}}">{{$e.nurl}}</a></td>
+                       <td>{{$e.network}}</td>
+                       <td>{{$e.created}}</td>
+                       <td>{{$e.last}}</td>
+               </tr>
+               {{/foreach}}
+       </table>
+</div>
diff --git a/view/templates/admin/settings_features.tpl b/view/templates/admin/settings_features.tpl
new file mode 100644 (file)
index 0000000..abcc527
--- /dev/null
@@ -0,0 +1,21 @@
+<h1>{{$title}}</h1>
+
+<form action="admin/features" method="post" autocomplete="off">
+<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+
+{{foreach $features as $g => $f}}
+<h3 class="settings-heading"><a href="javascript:;">{{$f.0}}</a></h3>
+
+<div class="settings-content-block">
+       {{foreach $f.1 as $fcat}}
+               {{include file="field_yesno.tpl" field=$fcat.0}}
+               {{include file="field_yesno.tpl" field=$fcat.1}}
+       {{/foreach}}
+
+       <div class="settings-submit-wrapper" >
+               <input type="submit" name="submit" class="settings-features-submit" value="{{$submit|escape:'html'}}" />
+       </div>
+</div>
+{{/foreach}}
+
+</form>
diff --git a/view/templates/admin/settings_head.tpl b/view/templates/admin/settings_head.tpl
new file mode 100644 (file)
index 0000000..25c0f80
--- /dev/null
@@ -0,0 +1,9 @@
+<script>
+       $(document).ready(function() {
+               $('.settings-content-block').hide();
+               $('.settings-heading').click(function(){
+                       $('.settings-content-block').hide();
+                       $(this).next('.settings-content-block').toggle();
+               });
+       });
+</script>
diff --git a/view/templates/admin/site.tpl b/view/templates/admin/site.tpl
new file mode 100644 (file)
index 0000000..9f7b360
--- /dev/null
@@ -0,0 +1,160 @@
+<script>
+       $(function(){
+
+               $("#cnftheme").click(function(){
+                       $.colorbox({
+                               width: 800,
+                               height: '90%',
+                               /*onOpen: function(){
+                                       var theme = $("#id_theme :selected").val();
+                                       $("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
+                               },*/
+                               href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val(),
+                               onComplete: function(){
+                                       $("div#fancybox-content form").submit(function(e){
+                                               var url = $(this).attr('action');
+                                               // can't get .serialize() to work...
+                                               var data={};
+                                               $(this).find("input").each(function(){
+                                                       data[$(this).attr('name')] = $(this).val();
+                                               });
+                                               $(this).find("select").each(function(){
+                                                       data[$(this).attr('name')] = $(this).children(":selected").val();
+                                               });
+                                               console.log(":)", url, data);
+
+                                               $.post(url, data, function(data) {
+                                                       if(timer) clearTimeout(timer);
+                                                       NavUpdate();
+                                                       $.colorbox.close();
+                                               })
+
+                                               return false;
+                                       });
+
+                               }
+                       });
+                       return false;
+               });
+       });
+</script>
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+
+       <form action="{{$baseurl}}/admin/site" method="post">
+    <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+
+       {{include file="field_input.tpl" field=$sitename}}
+       {{include file="field_input.tpl" field=$hostname}}
+       {{include file="field_input.tpl" field=$sender_email}}
+       {{include file="field_textarea.tpl" field=$banner}}
+       {{include file="field_input.tpl" field=$shortcut_icon}}
+       {{include file="field_input.tpl" field=$touch_icon}}
+       {{include file="field_textarea.tpl" field=$info}}
+       {{include file="field_select.tpl" field=$language}}
+       {{include file="field_select.tpl" field=$theme}}
+       {{include file="field_select.tpl" field=$theme_mobile}}
+       {{include file="field_select.tpl" field=$ssl_policy}}
+       {{if $ssl_policy.2 == 1}}{{include file="field_checkbox.tpl" field=$force_ssl}}{{/if}}
+       {{include file="field_checkbox.tpl" field=$hide_help}}
+       {{include file="field_select.tpl" field=$singleuser}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       <h3>{{$registration}}</h3>
+       {{include file="field_input.tpl" field=$register_text}}
+       {{include file="field_select.tpl" field=$register_policy}}
+       {{include file="field_input.tpl" field=$daily_registrations}}
+       {{include file="field_checkbox.tpl" field=$no_multi_reg}}
+       {{include file="field_checkbox.tpl" field=$no_openid}}
+       {{include file="field_checkbox.tpl" field=$no_regfullname}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       <h3>{{$upload}}</h3>
+       {{include file="field_input.tpl" field=$maximagesize}}
+       {{include file="field_input.tpl" field=$maximagelength}}
+       {{include file="field_input.tpl" field=$jpegimagequality}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       <h3>{{$corporate}}</h3>
+       {{include file="field_input.tpl" field=$allowed_sites}}
+       {{include file="field_input.tpl" field=$allowed_email}}
+       {{include file="field_checkbox.tpl" field=$block_public}}
+       {{include file="field_checkbox.tpl" field=$force_publish}}
+       {{include file="field_select.tpl" field=$community_page_style}}
+       {{include file="field_input.tpl" field=$max_author_posts_community_page}}
+
+       {{include file="field_checkbox.tpl" field=$ostatus_disabled}}
+       {{include file="field_checkbox.tpl" field=$ostatus_full_threads}}
+
+       {{if $diaspora_able}}
+               {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
+       {{else}}
+               <div class='field checkbox' id='div_id_{{$diaspora_enabled.0}}'>
+                       <label for='id_{{$diaspora_enabled.0}}'>{{$diaspora_enabled.1}}</label>
+                       <span id='id_{{$diaspora_enabled.0}}'>{{$diaspora_not_able}}</span>
+               </div>
+       {{/if}}
+       {{include file="field_checkbox.tpl" field=$dfrn_only}}
+       {{include file="field_input.tpl" field=$global_directory}}
+       <div class="submit"><input type="submit" name="republish_directory" value="{{$republish|escape:'html'}}" /></div>
+       {{include file="field_checkbox.tpl" field=$newuser_private}}
+       {{include file="field_checkbox.tpl" field=$enotify_no_content}}
+       {{include file="field_checkbox.tpl" field=$private_addons}}
+       {{include file="field_checkbox.tpl" field=$disable_embedded}}
+       {{include file="field_checkbox.tpl" field=$allow_users_remote_self}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       <h3>{{$advanced}}</h3>
+       {{include file="field_select.tpl" field=$rino}}
+       {{include file="field_checkbox.tpl" field=$verifyssl}}
+       {{include file="field_input.tpl" field=$proxy}}
+       {{include file="field_input.tpl" field=$proxyuser}}
+       {{include file="field_input.tpl" field=$timeout}}
+       {{include file="field_input.tpl" field=$maxloadavg_frontend}}
+       {{include file="field_input.tpl" field=$optimize_max_tablesize}}
+       {{include file="field_input.tpl" field=$optimize_fragmentation}}
+       {{include file="field_input.tpl" field=$abandon_days}}
+       {{include file="field_input.tpl" field=$temppath}}
+       {{include file="field_input.tpl" field=$basepath}}
+       {{include file="field_checkbox.tpl" field=$suppress_tags}}
+       {{include file="field_checkbox.tpl" field=$nodeinfo}}
+       {{include file="field_select.tpl" field=$check_new_version_url}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       <h3>{{$portable_contacts}}</h3>
+       {{include file="field_checkbox.tpl" field=$poco_completion}}
+       {{include file="field_input.tpl" field=$poco_requery_days}}
+       {{include file="field_select.tpl" field=$poco_discovery}}
+       {{include file="field_select.tpl" field=$poco_discovery_since}}
+       {{include file="field_checkbox.tpl" field=$poco_local_search}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       <h3>{{$performance}}</h3>
+       {{include file="field_checkbox.tpl" field=$only_tag_search}}
+       {{include file="field_input.tpl" field=$itemcache}}
+       {{include file="field_input.tpl" field=$itemcache_duration}}
+       {{include file="field_input.tpl" field=$max_comments}}
+       {{include file="field_checkbox.tpl" field=$proxy_disabled}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       <h3>{{$worker_title}}</h3>
+       {{include file="field_input.tpl" field=$maxloadavg}}
+       {{include file="field_input.tpl" field=$min_memory}}
+       {{include file="field_input.tpl" field=$worker_queues}}
+       {{include file="field_checkbox.tpl" field=$worker_dont_fork}}
+       {{include file="field_checkbox.tpl" field=$worker_fastlane}}
+       {{include file="field_checkbox.tpl" field=$worker_frontend}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
+
+       </form>
+
+       {{* separate form for relocate... *}}
+       <form action="{{$baseurl}}/admin/site" method="post">
+       <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+       <h3>{{$relocate}}</h3>
+       {{include file="field_input.tpl" field=$relocate_url}}
+       <input type="hidden" name="page_site" value="{{$submit|escape:'html'}}">
+       <div class="submit"><input type="submit" name="relocate" value="{{$submit|escape:'html'}}" /></div>
+       </form>
+
+</div>
diff --git a/view/templates/admin/summary.tpl b/view/templates/admin/summary.tpl
new file mode 100644 (file)
index 0000000..e650144
--- /dev/null
@@ -0,0 +1,48 @@
+
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+{{if $showwarning}}
+       <div id="admin-warning-message-wrapper">
+               {{foreach $warningtext as $wt}}
+               <p class="warning-message">{{$wt}}</p>
+               {{/foreach}}
+       </div>
+{{/if}}
+
+       <dl>
+               <dt>{{$queues.label}}</dt>
+               <dd><a href="{{$baseurl}}/admin/queue">{{$queues.queue}}</a> - {{$queues.workerq}}</dd>
+       </dl>
+       <dl>
+               <dt>{{$pending.0}}</dt>
+               <dd>{{$pending.1}}</dt>
+       </dl>
+
+       <dl>
+               <dt>{{$users.0}}</dt>
+               <dd>{{$users.1}}</dd>
+       </dl>
+       {{foreach $accounts as $p}}
+               <dl>
+                       <dt>{{$p.0}}</dt>
+                       <dd>{{if $p.1}}{{$p.1}}{{else}}0{{/if}}</dd>
+               </dl>
+       {{/foreach}}
+
+
+       <dl>
+               <dt>{{$plugins.0}}</dt>
+               
+               {{foreach $plugins.1 as $p}}
+                       <dd><a href="/admin/plugins/{{$p}}/">{{$p}}</a></dd>
+               {{/foreach}}
+               
+       </dl>
+
+       <dl>
+               <dt>{{$version.0}}</dt>
+               <dd> {{$platform}} '{{$codename}}' {{$version.1}} - {{$build}}</dt>
+       </dl>
+
+
+</div>
diff --git a/view/templates/admin/users.tpl b/view/templates/admin/users.tpl
new file mode 100644 (file)
index 0000000..a842d6e
--- /dev/null
@@ -0,0 +1,155 @@
+
+<script>
+       function confirm_delete(uname){
+               return confirm( "{{$confirm_delete}}".format(uname));
+       }
+       function confirm_delete_multi(){
+               return confirm("{{$confirm_delete_multi}}");
+       }
+       function selectall(cls){
+               $("."+cls).attr('checked','checked');
+               return false;
+       }
+</script>
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <form action="{{$baseurl}}/admin/users" method="post">
+        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+               
+               <h3>{{$h_pending}}</h3>
+               {{if $pending}}
+                       <table id='pending'>
+                               <thead>
+                               <tr>
+                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                       {{foreach $pending as $u}}
+                               <tr>
+                                       <td class="created">{{$u.created}}</td>
+                                       <td class="name">{{$u.name}}</td>
+                                       <td class="email">{{$u.email}}</td>
+                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
+                                       <td class="tools">
+                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='icon like'></span></a>
+                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='icon dislike'></span></a>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td class="pendingnote"><p><span>{{$pendingnotetext}}:</span> {{$u.note}}</p></td>
+                               </tr>
+                       {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny|escape:'html'}}"/> <input type="submit" name="page_users_approve" value="{{$approve|escape:'html'}}" /></div>                    
+               {{else}}
+                       <p>{{$no_pending}}</p>
+               {{/if}}
+       
+               <h3>{{$h_users}}</h3>
+               {{if $users}}
+                       <table id='users'>
+                               <thead>
+                               <tr>
+                                       <th></th>
+                                       {{foreach $th_users as $th}}
+                                       <th>
+                                               <a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}">
+                                                       {{if $order_users == $th.1}}
+                                                               {{if $order_direction_users == "+"}}
+                                                               &#8595;
+                                                               {{else}}
+                                                               &#8593;
+                                                               {{/if}}
+                                                       {{else}}
+                                                               &#8597;
+                                                       {{/if}}
+                                               {{$th.0}}</a>
+                                       </th>
+                                       {{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                               {{foreach $users as $u}}
+                                       <tr>
+                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
+                                               <td class='email'>{{$u.email}}</td>
+                                               <td class='register_date'>{{$u.register_date}}</td>
+                                               <td class='login_date'>{{$u.login_date}}</td>
+                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
+                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
+                                               <td class="checkbox"> 
+                                               {{if $u.is_deletable}}
+                                                       <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
+                                               {{else}}
+                                                       &nbsp;
+                                               {{/if}}
+                                               <td class="tools">
+                                               {{if $u.is_deletable}}
+                                                       <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>
+                                                       <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon drop'></span></a>
+                                               {{else}}
+                                                       &nbsp;
+                                               {{/if}}
+                                               </td>
+                                       </tr>
+                               {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block|escape:'html'}}/{{$unblock|escape:'html'}}" /> <input type="submit" name="page_users_delete" value="{{$delete|escape:'html'}}" onclick="return confirm_delete_multi()" /></div>                                                
+               {{else}}
+                       NO USERS?!?
+               {{/if}}
+       </form>
+       {{if $deleted}}
+               <h3>{{$h_deleted}}</h3>
+                       <table id='deleted'>
+                               <thead>
+                               <tr>
+                                       <th></th>
+                                       {{foreach $th_deleted as $th}}<th>{{$th}}</th>{{/foreach}}
+                               </tr>
+                               </thead>
+                               <tbody>
+                               {{foreach $deleted as $u}}
+                                       <tr>
+                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
+                                               <td class='email'>{{$u.email}}</td>
+                                               <td class='register_date'>{{$u.register_date}}</td>
+                                               <td class='login_date'>{{$u.login_date}}</td>
+                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
+                                               <td class='login_date'>{{$u.deleted}}</td>
+                                       </tr>
+                               {{/foreach}}
+                               </tbody>
+                       </table>
+               {{/if}}
+  <h3>{{$h_newuser}}</h3> 
+  <form action="{{$baseurl}}/admin/users" method="post"> 
+  <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> 
+  <table id='users'> 
+      <tbody> 
+        <tr> 
+        <td>{{include file="field_input.tpl" field=$newusername}}</td> 
+    </tr> 
+        <tr> 
+        <td>{{include file="field_input.tpl" field=$newusernickname}}</td> 
+    </tr> 
+        <tr> 
+        <td>{{include file="field_input.tpl" field=$newuseremail}}</td> 
+    </tr> 
+      </tbody> 
+  </table> 
+  <div class="submit"><input type="submit" name="add_new_user_submit" value="{{$submit|escape:'html'}}" /></div>             
+  </form>
+</div>
diff --git a/view/templates/admin/viewlogs.tpl b/view/templates/admin/viewlogs.tpl
new file mode 100644 (file)
index 0000000..c80264c
--- /dev/null
@@ -0,0 +1,6 @@
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <h3>{{$logname}}</h3>
+       <div style="width:100%; height:400px; overflow: auto; "><pre>{{$data}}</pre></div>
+</div>
diff --git a/view/templates/admin_aside.tpl b/view/templates/admin_aside.tpl
deleted file mode 100644 (file)
index 5c9cce0..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<script>
-       // update pending count //
-       $(function(){
-
-               $("nav").bind('nav-update',  function(e,data){
-                       var elm = $('#pending-update');
-                       var register = $(data).find('register').text();
-                       if (register=="0") { register=""; elm.hide();} else { elm.show(); }
-                       elm.html(register);
-               });
-       });
-</script>
-
-<h4><a href="{{$admurl}}">{{$admtxt}}</a></h4>
-<ul class='admin linklist'>
-{{foreach $subpages as $page}}
-       <li class='admin link button {{$page.2}}'><a href='{{$page.0}}'>{{$page.1}}</a></li>
-{{/foreach}}
-</ul>
-
-{{if $admin.update}}
-<ul class='admin linklist'>
-       <li class='admin link button {{$admin.update.2}}'><a href='{{$admin.update.0}}'>{{$admin.update.1}}</a></li>
-       <li class='admin link button {{$admin.update.2}}'><a href='https://kakste.com/profile/inthegit'>Important Changes</a></li>
-</ul>
-{{/if}}
-
-
-{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
-<ul class='admin linklist'>
-       {{foreach $admin.plugins_admin as $l}}
-       <li class='admin link button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
-       {{/foreach}}
-</ul>
-       
-       
-<h4>{{$logtxt}}</h4>
-<ul class='admin linklist'>
-       <li class='admin link button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
-       <li class='admin link button {{$admin.viewlogs.2}}'><a href='{{$admin.viewlogs.0}}'>{{$admin.viewlogs.1}}</a></li>
-</ul>
-
-<h4>{{$diagnosticstxt}}</h4>
-<ul class='admin linklist'>
-       <li class='admin link {{$admin.diagnostics_probe.2}}'><a href="{{$admin.diagnostics_probe.0}}">{{$admin.diagnostics_probe.1}}</a></li>
-       <li class='admin link {{$admin.diagnostics_webfinger.2}}'><a href="{{$admin.diagnostics_webfinger.0}}">{{$admin.diagnostics_webfinger.1}}</a></li>
-</ul>
diff --git a/view/templates/admin_blocklist.tpl b/view/templates/admin_blocklist.tpl
deleted file mode 100644 (file)
index 1484c98..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<script>
-       function confirm_delete(uname){
-               return confirm("{{$confirm_delete}}".format(uname));
-       }
-</script>
-<div id="adminpage">
-       <h1>{{$title}} - {{$page}}</h1>
-       <p>{{$intro}}</p>
-       <p>{{$public}}</p>
-
-       <h2>{{$addtitle}}</h2>
-       <form action="{{$baseurl}}/admin/blocklist" method="post">
-               <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
-               {{include file="field_input.tpl" field=$newdomain}}
-               {{include file="field_input.tpl" field=$newreason}}
-               <div class="submit"><input type="submit" name="page_blocklist_save" value="{{$submit}}" /></div>
-       </form>
-
-       {{if $entries}}
-       <h2>{{$currenttitle}}</h2>
-       <p>{{$currentintro}}</p>
-       <form action="{{$baseurl}}/admin/blocklist" method="post">
-               <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
-               {{foreach $entries as $e}}
-                       {{include file="field_input.tpl" field=$e.domain}}
-                       {{include file="field_input.tpl" field=$e.reason}}
-                       {{include file="field_checkbox.tpl" field=$e.delete}}
-               {{/foreach}}
-               <div class="submit"><input type="submit" name="page_blocklist_edit" value="{{$savechanges}}" /></div>
-               {{/if}}
-       </form>
-
-</div>
diff --git a/view/templates/admin_deleteitem.tpl b/view/templates/admin_deleteitem.tpl
deleted file mode 100644 (file)
index cf819de..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<div id="adminpage">
-       <h1>{{$title}} - {{$page}}</h1>
-       <p>{{$intro1}}</p>
-       <p>{{$intro2}}</p>
-</div>
-
-<form action="{{$baseurl}}/admin/deleteitem" method="post">
-       <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
-       {{include file="field_input.tpl" field=$deleteitemguid}}
-       <div class="submit"><input type="submit" name="page_deleteitem_submit" value="{{$submit}}" /></div>
-</form>
diff --git a/view/templates/admin_federation.tpl b/view/templates/admin_federation.tpl
deleted file mode 100644 (file)
index ee33df0..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<script src="{{$baseurl}}/library/Chart.js-1.0.2/Chart.min.js"></script>
-<canvas id="FederationChart" class="federation-graph"></canvas>
-<div id="adminpage">
-    <h1>{{$title}} - {{$page}}</h1>
-    <p>{{$intro}}</p>
-    {{if not $autoactive}}
-       <p class="error-message">{{$hint}}</p>
-    {{/if}}
-    <p>{{$legendtext}}
-    <ul>
-    {{foreach $counts as $c}}
-       {{if $c[0]['total'] > 0}}
-           <li>{{$c[0]['platform']}} ({{$c[0]['total']}})</li>
-       {{/if}}
-    {{/foreach}}
-    </ul>
-    </p>
-</div>
-<script>
-var FedData = [
-{{foreach $counts as $c}}
-    { value: {{$c[0]['total']}}, label: "{{$c[0]['platform']}}", color: '{{$c[3]}}', highlight: "#EE90A1", },
-{{/foreach}}
-];
-var ctx = document.getElementById("FederationChart").getContext("2d");
-var myDoughnutChart = new Chart(ctx).Doughnut(FedData, { animateRotate : false, });
-</script>
-
-<table id="federation-stats">
-{{foreach $counts as $c}}
-    {{if $c[0]['total'] > 0}}
-    <tr>
-           <th>{{$c[0]['platform']}}</th>
-           <th><strong>{{$c[0]['total']}}</strong></td>
-           <td>{{$c[0]['network']}}</td>
-    </tr>
-    <tr>
-    <td colspan="3" class="federation-data">
-    <canvas id="{{$c[2]}}Chart" class="federation-network-graph"></canvas>
-    <script>
-    var {{$c[2]}}data = [
-    {{foreach $c[1] as $v}}
-       { value: {{$v['total']}}, label: '{{$v['version']}}', color: "{{$c[3]}}", highlight: "#EE90A1",},
-    {{/foreach}}
-    ];
-    var ctx = document.getElementById("{{$c[2]}}Chart").getContext("2d");
-    var my{{$c[2]}}DoughnutChart = new Chart(ctx).Doughnut({{$c[2]}}data, {animateRotate : false,});
-    </script>
-    <ul class="federation-stats">
-    {{foreach $c[1] as $v}}
-       <li>{{if ($c[0]['platform']==='Friendica' and  $version===$v['version']) }}<span class="version-match">{{$v['version']}}</span>{{else}}{{$v['version']}}{{/if}} ({{$v['total']}})</li>
-    {{/foreach}}
-    </ul>
-    </td>
-    </tr>
-    {{/if}}
-{{/foreach}}
-</table>
diff --git a/view/templates/admin_logs.tpl b/view/templates/admin_logs.tpl
deleted file mode 100644 (file)
index b2e6357..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<div id='adminpage'>
-    <h1>{{$title}} - {{$page}}</h1>
-       
-       <form action="{{$baseurl}}/admin/logs" method="post">
-           <input type='hidden' name='form_security_token' value="{{$form_security_token|escape:'html'}}">
-
-           {{include file="field_checkbox.tpl" field=$debugging}}
-           {{include file="field_input.tpl" field=$logfile}}
-           {{include file="field_select.tpl" field=$loglevel}}
-       
-           <div class="submit"><input type="submit" name="page_logs" value="{{$submit|escape:'html'}}" /></div>
-       
-       </form>
-
-       <h2>{{$phpheader}}</h2>
-       <div>
-               <p>{{$phplogenabled}}<p>
-               <p>{{$phphint}}</p>
-               <pre>{{$phplogcode}}</pre>
-       </div>
-       
-</div>
diff --git a/view/templates/admin_plugins.tpl b/view/templates/admin_plugins.tpl
deleted file mode 100644 (file)
index 75565dd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-               {{if $pcount eq 0}}
-                   <div class="error-message">
-                   {{$noplugshint}}
-                   </div>
-               {{else}}
-               <a class="btn" href="{{$baseurl}}/admin/{{$function}}?a=r&amp;t={{$form_security_token}}">{{$reload}}</a>
-               <ul id='pluginslist'>
-               {{foreach $plugins as $p}}
-                       <li class='plugin {{$p.1}}'>
-                               <a class='toggleplugin' href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}?a=t&amp;t={{$form_security_token}}' title="{{if $p.1==on}}Disable{{else}}Enable{{/if}}" ><span class='icon {{$p.1}}'></span></a>
-                               <a href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}'><span class='name'>{{$p.2.name}}</span></a> - <span class="version">{{$p.2.version}}</span>
-                               {{if $p.2.experimental}} {{$experimental}} {{/if}}{{if $p.2.unsupported}} {{$unsupported}} {{/if}}
-
-                                       <div class='desc'>{{$p.2.description}}</div>
-                       </li>
-               {{/foreach}}
-               </ul>
-               {{/if}}
-</div>
diff --git a/view/templates/admin_plugins_details.tpl b/view/templates/admin_plugins_details.tpl
deleted file mode 100644 (file)
index 9def8fc..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <p><span class='toggleplugin icon {{$status}}'></span> {{$info.name}} - {{$info.version}} : <a href="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/?a=t&amp;t={{$form_security_token}}">{{$action}}</a></p>
-       <p>{{$info.description}}</p>
-       
-       <p class="author">{{$str_author}}
-       {{foreach $info.author as $a}}
-               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
-       {{/foreach}}
-       </p>
-
-       <p class="maintainer">{{$str_maintainer}}
-       {{foreach $info.maintainer as $a}}
-               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
-       {{/foreach}}
-       </p>
-       
-       {{if $screenshot}}
-       <a href="{{$screenshot.0}}" class='screenshot'><img src="{{$screenshot.0}}" alt="{{$screenshot.1}}" /></a>
-       {{/if}}
-
-       {{if $admin_form}}
-       <h3>{{$settings}}</h3>
-       <form method="post" action="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/">
-               {{$admin_form}}
-       </form>
-       {{/if}}
-
-       {{if $readme}}
-       <h3>Readme</h3>
-       <div id="plugin_readme">
-               {{$readme}}
-       </div>
-       {{/if}}
-</div>
diff --git a/view/templates/admin_queue.tpl b/view/templates/admin_queue.tpl
deleted file mode 100644 (file)
index aaca9b0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}} ({{$count}})</h1>
-       
-       <p>{{$info}}</p>
-       <table>
-               <tr>
-                       <th>{{$id_header}}</th>
-                       <th>{{$to_header}}</th>
-                       <th>{{$url_header}}</th>
-                       <th>{{$network_header}}</th>
-                       <th>{{$created_header}}</th>
-                       <th>{{$last_header}}</th>
-               </tr>
-               {{foreach $entries as $e}}
-               <tr>
-                       <td>{{$e.id}}</td>
-                       <td>{{$e.name}}</td>
-                       <td><a href="{{$e.nurl}}">{{$e.nurl}}</a></td>
-                       <td>{{$e.network}}</td>
-                       <td>{{$e.created}}</td>
-                       <td>{{$e.last}}</td>
-               </tr>
-               {{/foreach}}
-       </table>
-</div>
diff --git a/view/templates/admin_settings_features.tpl b/view/templates/admin_settings_features.tpl
deleted file mode 100644 (file)
index abcc527..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<h1>{{$title}}</h1>
-
-<form action="admin/features" method="post" autocomplete="off">
-<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-
-{{foreach $features as $g => $f}}
-<h3 class="settings-heading"><a href="javascript:;">{{$f.0}}</a></h3>
-
-<div class="settings-content-block">
-       {{foreach $f.1 as $fcat}}
-               {{include file="field_yesno.tpl" field=$fcat.0}}
-               {{include file="field_yesno.tpl" field=$fcat.1}}
-       {{/foreach}}
-
-       <div class="settings-submit-wrapper" >
-               <input type="submit" name="submit" class="settings-features-submit" value="{{$submit|escape:'html'}}" />
-       </div>
-</div>
-{{/foreach}}
-
-</form>
diff --git a/view/templates/admin_settings_head.tpl b/view/templates/admin_settings_head.tpl
deleted file mode 100644 (file)
index 25c0f80..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<script>
-       $(document).ready(function() {
-               $('.settings-content-block').hide();
-               $('.settings-heading').click(function(){
-                       $('.settings-content-block').hide();
-                       $(this).next('.settings-content-block').toggle();
-               });
-       });
-</script>
diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl
deleted file mode 100644 (file)
index 9f7b360..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-<script>
-       $(function(){
-
-               $("#cnftheme").click(function(){
-                       $.colorbox({
-                               width: 800,
-                               height: '90%',
-                               /*onOpen: function(){
-                                       var theme = $("#id_theme :selected").val();
-                                       $("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
-                               },*/
-                               href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val(),
-                               onComplete: function(){
-                                       $("div#fancybox-content form").submit(function(e){
-                                               var url = $(this).attr('action');
-                                               // can't get .serialize() to work...
-                                               var data={};
-                                               $(this).find("input").each(function(){
-                                                       data[$(this).attr('name')] = $(this).val();
-                                               });
-                                               $(this).find("select").each(function(){
-                                                       data[$(this).attr('name')] = $(this).children(":selected").val();
-                                               });
-                                               console.log(":)", url, data);
-
-                                               $.post(url, data, function(data) {
-                                                       if(timer) clearTimeout(timer);
-                                                       NavUpdate();
-                                                       $.colorbox.close();
-                                               })
-
-                                               return false;
-                                       });
-
-                               }
-                       });
-                       return false;
-               });
-       });
-</script>
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-
-       <form action="{{$baseurl}}/admin/site" method="post">
-    <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-
-       {{include file="field_input.tpl" field=$sitename}}
-       {{include file="field_input.tpl" field=$hostname}}
-       {{include file="field_input.tpl" field=$sender_email}}
-       {{include file="field_textarea.tpl" field=$banner}}
-       {{include file="field_input.tpl" field=$shortcut_icon}}
-       {{include file="field_input.tpl" field=$touch_icon}}
-       {{include file="field_textarea.tpl" field=$info}}
-       {{include file="field_select.tpl" field=$language}}
-       {{include file="field_select.tpl" field=$theme}}
-       {{include file="field_select.tpl" field=$theme_mobile}}
-       {{include file="field_select.tpl" field=$ssl_policy}}
-       {{if $ssl_policy.2 == 1}}{{include file="field_checkbox.tpl" field=$force_ssl}}{{/if}}
-       {{include file="field_checkbox.tpl" field=$hide_help}}
-       {{include file="field_select.tpl" field=$singleuser}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       <h3>{{$registration}}</h3>
-       {{include file="field_input.tpl" field=$register_text}}
-       {{include file="field_select.tpl" field=$register_policy}}
-       {{include file="field_input.tpl" field=$daily_registrations}}
-       {{include file="field_checkbox.tpl" field=$no_multi_reg}}
-       {{include file="field_checkbox.tpl" field=$no_openid}}
-       {{include file="field_checkbox.tpl" field=$no_regfullname}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       <h3>{{$upload}}</h3>
-       {{include file="field_input.tpl" field=$maximagesize}}
-       {{include file="field_input.tpl" field=$maximagelength}}
-       {{include file="field_input.tpl" field=$jpegimagequality}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       <h3>{{$corporate}}</h3>
-       {{include file="field_input.tpl" field=$allowed_sites}}
-       {{include file="field_input.tpl" field=$allowed_email}}
-       {{include file="field_checkbox.tpl" field=$block_public}}
-       {{include file="field_checkbox.tpl" field=$force_publish}}
-       {{include file="field_select.tpl" field=$community_page_style}}
-       {{include file="field_input.tpl" field=$max_author_posts_community_page}}
-
-       {{include file="field_checkbox.tpl" field=$ostatus_disabled}}
-       {{include file="field_checkbox.tpl" field=$ostatus_full_threads}}
-
-       {{if $diaspora_able}}
-               {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
-       {{else}}
-               <div class='field checkbox' id='div_id_{{$diaspora_enabled.0}}'>
-                       <label for='id_{{$diaspora_enabled.0}}'>{{$diaspora_enabled.1}}</label>
-                       <span id='id_{{$diaspora_enabled.0}}'>{{$diaspora_not_able}}</span>
-               </div>
-       {{/if}}
-       {{include file="field_checkbox.tpl" field=$dfrn_only}}
-       {{include file="field_input.tpl" field=$global_directory}}
-       <div class="submit"><input type="submit" name="republish_directory" value="{{$republish|escape:'html'}}" /></div>
-       {{include file="field_checkbox.tpl" field=$newuser_private}}
-       {{include file="field_checkbox.tpl" field=$enotify_no_content}}
-       {{include file="field_checkbox.tpl" field=$private_addons}}
-       {{include file="field_checkbox.tpl" field=$disable_embedded}}
-       {{include file="field_checkbox.tpl" field=$allow_users_remote_self}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       <h3>{{$advanced}}</h3>
-       {{include file="field_select.tpl" field=$rino}}
-       {{include file="field_checkbox.tpl" field=$verifyssl}}
-       {{include file="field_input.tpl" field=$proxy}}
-       {{include file="field_input.tpl" field=$proxyuser}}
-       {{include file="field_input.tpl" field=$timeout}}
-       {{include file="field_input.tpl" field=$maxloadavg_frontend}}
-       {{include file="field_input.tpl" field=$optimize_max_tablesize}}
-       {{include file="field_input.tpl" field=$optimize_fragmentation}}
-       {{include file="field_input.tpl" field=$abandon_days}}
-       {{include file="field_input.tpl" field=$temppath}}
-       {{include file="field_input.tpl" field=$basepath}}
-       {{include file="field_checkbox.tpl" field=$suppress_tags}}
-       {{include file="field_checkbox.tpl" field=$nodeinfo}}
-       {{include file="field_select.tpl" field=$check_new_version_url}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       <h3>{{$portable_contacts}}</h3>
-       {{include file="field_checkbox.tpl" field=$poco_completion}}
-       {{include file="field_input.tpl" field=$poco_requery_days}}
-       {{include file="field_select.tpl" field=$poco_discovery}}
-       {{include file="field_select.tpl" field=$poco_discovery_since}}
-       {{include file="field_checkbox.tpl" field=$poco_local_search}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       <h3>{{$performance}}</h3>
-       {{include file="field_checkbox.tpl" field=$only_tag_search}}
-       {{include file="field_input.tpl" field=$itemcache}}
-       {{include file="field_input.tpl" field=$itemcache_duration}}
-       {{include file="field_input.tpl" field=$max_comments}}
-       {{include file="field_checkbox.tpl" field=$proxy_disabled}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       <h3>{{$worker_title}}</h3>
-       {{include file="field_input.tpl" field=$maxloadavg}}
-       {{include file="field_input.tpl" field=$min_memory}}
-       {{include file="field_input.tpl" field=$worker_queues}}
-       {{include file="field_checkbox.tpl" field=$worker_dont_fork}}
-       {{include file="field_checkbox.tpl" field=$worker_fastlane}}
-       {{include file="field_checkbox.tpl" field=$worker_frontend}}
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
-
-       </form>
-
-       {{* separate form for relocate... *}}
-       <form action="{{$baseurl}}/admin/site" method="post">
-       <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-       <h3>{{$relocate}}</h3>
-       {{include file="field_input.tpl" field=$relocate_url}}
-       <input type="hidden" name="page_site" value="{{$submit|escape:'html'}}">
-       <div class="submit"><input type="submit" name="relocate" value="{{$submit|escape:'html'}}" /></div>
-       </form>
-
-</div>
diff --git a/view/templates/admin_summary.tpl b/view/templates/admin_summary.tpl
deleted file mode 100644 (file)
index e650144..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-{{if $showwarning}}
-       <div id="admin-warning-message-wrapper">
-               {{foreach $warningtext as $wt}}
-               <p class="warning-message">{{$wt}}</p>
-               {{/foreach}}
-       </div>
-{{/if}}
-
-       <dl>
-               <dt>{{$queues.label}}</dt>
-               <dd><a href="{{$baseurl}}/admin/queue">{{$queues.queue}}</a> - {{$queues.workerq}}</dd>
-       </dl>
-       <dl>
-               <dt>{{$pending.0}}</dt>
-               <dd>{{$pending.1}}</dt>
-       </dl>
-
-       <dl>
-               <dt>{{$users.0}}</dt>
-               <dd>{{$users.1}}</dd>
-       </dl>
-       {{foreach $accounts as $p}}
-               <dl>
-                       <dt>{{$p.0}}</dt>
-                       <dd>{{if $p.1}}{{$p.1}}{{else}}0{{/if}}</dd>
-               </dl>
-       {{/foreach}}
-
-
-       <dl>
-               <dt>{{$plugins.0}}</dt>
-               
-               {{foreach $plugins.1 as $p}}
-                       <dd><a href="/admin/plugins/{{$p}}/">{{$p}}</a></dd>
-               {{/foreach}}
-               
-       </dl>
-
-       <dl>
-               <dt>{{$version.0}}</dt>
-               <dd> {{$platform}} '{{$codename}}' {{$version.1}} - {{$build}}</dt>
-       </dl>
-
-
-</div>
diff --git a/view/templates/admin_users.tpl b/view/templates/admin_users.tpl
deleted file mode 100644 (file)
index a842d6e..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-
-<script>
-       function confirm_delete(uname){
-               return confirm( "{{$confirm_delete}}".format(uname));
-       }
-       function confirm_delete_multi(){
-               return confirm("{{$confirm_delete_multi}}");
-       }
-       function selectall(cls){
-               $("."+cls).attr('checked','checked');
-               return false;
-       }
-</script>
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <form action="{{$baseurl}}/admin/users" method="post">
-        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-               
-               <h3>{{$h_pending}}</h3>
-               {{if $pending}}
-                       <table id='pending'>
-                               <thead>
-                               <tr>
-                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                       {{foreach $pending as $u}}
-                               <tr>
-                                       <td class="created">{{$u.created}}</td>
-                                       <td class="name">{{$u.name}}</td>
-                                       <td class="email">{{$u.email}}</td>
-                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
-                                       <td class="tools">
-                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='icon like'></span></a>
-                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='icon dislike'></span></a>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td class="pendingnote"><p><span>{{$pendingnotetext}}:</span> {{$u.note}}</p></td>
-                               </tr>
-                       {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny|escape:'html'}}"/> <input type="submit" name="page_users_approve" value="{{$approve|escape:'html'}}" /></div>                    
-               {{else}}
-                       <p>{{$no_pending}}</p>
-               {{/if}}
-       
-               <h3>{{$h_users}}</h3>
-               {{if $users}}
-                       <table id='users'>
-                               <thead>
-                               <tr>
-                                       <th></th>
-                                       {{foreach $th_users as $th}}
-                                       <th>
-                                               <a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}">
-                                                       {{if $order_users == $th.1}}
-                                                               {{if $order_direction_users == "+"}}
-                                                               &#8595;
-                                                               {{else}}
-                                                               &#8593;
-                                                               {{/if}}
-                                                       {{else}}
-                                                               &#8597;
-                                                       {{/if}}
-                                               {{$th.0}}</a>
-                                       </th>
-                                       {{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                               {{foreach $users as $u}}
-                                       <tr>
-                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
-                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
-                                               <td class='email'>{{$u.email}}</td>
-                                               <td class='register_date'>{{$u.register_date}}</td>
-                                               <td class='login_date'>{{$u.login_date}}</td>
-                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
-                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
-                                               <td class="checkbox"> 
-                                               {{if $u.is_deletable}}
-                                                       <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
-                                               {{else}}
-                                                       &nbsp;
-                                               {{/if}}
-                                               <td class="tools">
-                                               {{if $u.is_deletable}}
-                                                       <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>
-                                                       <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon drop'></span></a>
-                                               {{else}}
-                                                       &nbsp;
-                                               {{/if}}
-                                               </td>
-                                       </tr>
-                               {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block|escape:'html'}}/{{$unblock|escape:'html'}}" /> <input type="submit" name="page_users_delete" value="{{$delete|escape:'html'}}" onclick="return confirm_delete_multi()" /></div>                                                
-               {{else}}
-                       NO USERS?!?
-               {{/if}}
-       </form>
-       {{if $deleted}}
-               <h3>{{$h_deleted}}</h3>
-                       <table id='deleted'>
-                               <thead>
-                               <tr>
-                                       <th></th>
-                                       {{foreach $th_deleted as $th}}<th>{{$th}}</th>{{/foreach}}
-                               </tr>
-                               </thead>
-                               <tbody>
-                               {{foreach $deleted as $u}}
-                                       <tr>
-                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
-                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
-                                               <td class='email'>{{$u.email}}</td>
-                                               <td class='register_date'>{{$u.register_date}}</td>
-                                               <td class='login_date'>{{$u.login_date}}</td>
-                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
-                                               <td class='login_date'>{{$u.deleted}}</td>
-                                       </tr>
-                               {{/foreach}}
-                               </tbody>
-                       </table>
-               {{/if}}
-  <h3>{{$h_newuser}}</h3> 
-  <form action="{{$baseurl}}/admin/users" method="post"> 
-  <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> 
-  <table id='users'> 
-      <tbody> 
-        <tr> 
-        <td>{{include file="field_input.tpl" field=$newusername}}</td> 
-    </tr> 
-        <tr> 
-        <td>{{include file="field_input.tpl" field=$newusernickname}}</td> 
-    </tr> 
-        <tr> 
-        <td>{{include file="field_input.tpl" field=$newuseremail}}</td> 
-    </tr> 
-      </tbody> 
-  </table> 
-  <div class="submit"><input type="submit" name="add_new_user_submit" value="{{$submit|escape:'html'}}" /></div>             
-  </form>
-</div>
diff --git a/view/templates/admin_viewlogs.tpl b/view/templates/admin_viewlogs.tpl
deleted file mode 100644 (file)
index c80264c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <h3>{{$logname}}</h3>
-       <div style="width:100%; height:400px; overflow: auto; "><pre>{{$data}}</pre></div>
-</div>
index d6abde0306627874e9a75151c711b2dda87d517c..c7e10482ef0875e942c50ce9a5b51eaf135aca2f 100644 (file)
@@ -4,10 +4,9 @@
 <p id="dfrn-request-intro">
 {{$page_desc}}<br />
 <ul id="dfrn-request-networks">
-<li><a href="http://friendica.com" title="{{$friendica}}">{{$friendica}}</a></li>
-<li><a href="http://joindiaspora.com" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li>
-<li><a href="http://ostatus.org" title="{{$public_net}}" >{{$statusnet}}</a></li>
-{{if $emailnet}}<li>{{$emailnet}}</li>{{/if}}
+<li><a href="http://friendi.ca" title="{{$friendica}}">{{$friendica}}</a></li>
+<li><a href="https://diasporafoundation.org" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li>
+<li><a href="https://gnu.io/social/" title="{{$statusnet}}" >{{$statusnet}}</a></li>
 </ul>
 </p>
 <p>
index 5225bd60b22743f45b88c26c4be0601ac0608882..8e686c33dc1642df69898dc0ba7cfc3cbe6aa0aa 100644 (file)
@@ -5,10 +5,9 @@
 <p id="dfrn-request-intro">
 {{$page_desc}}<br />
 <ul id="dfrn-request-networks">
-<li><a href="http://friendica.com" title="{{$friendica}}">{{$friendica}}</a></li>
-<li><a href="http://joindiaspora.com" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li>
-<li><a href="http://ostatus.org" title="{{$public_net}}" >{{$statusnet}}</a></li>
-{{if $emailnet}}<li>{{$emailnet}}</li>{{/if}}
+<li><a href="http://friendi.ca" title="{{$friendica}}">{{$friendica}}</a></li>
+<li><a href="https://diasporafoundation.org" title="{{$diaspora}}">{{$diaspora}}</a> {{$diasnote}}</li>
+<li><a href="https://gnu.io/social/" title="{{$statusnet}}" >{{$statusnet}}</a></li>
 </ul>
 {{$invite_desc}}
 </p>
diff --git a/view/theme/frio/js/mod_admin.js b/view/theme/frio/js/mod_admin.js
new file mode 100644 (file)
index 0000000..b9fc467
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @brief Javascript for the admin module
+ */
+$(function() {
+       $('body').on('click', '.selectall', function() {
+               selectall($(this).data('selectAll'));
+       });
+       $('body').on('click', '.selectnone', function() {
+               selectnone($(this).data('selectNone'));
+       });
+
+       $('body').on('change', 'input[type=checkbox].select', function() {
+               $this = $(this);
+               if ($this.prop('checked')) {
+                       selectall($this.data('selectClass'));
+                       $this.attr('title', $this.data('selectNone'));
+               } else {
+                       selectnone($this.data('selectClass'));
+                       $this.attr('title', $this.data('selectAll'));
+               }
+       });
+
+       function selectall(cls) {
+               $('.' + cls).prop('checked', true);
+               return false;
+       }
+       function selectnone(cls) {
+               $('.' + cls).prop('checked', false);
+               return false;
+       }
+});
diff --git a/view/theme/frio/templates/admin/aside.tpl b/view/theme/frio/templates/admin/aside.tpl
new file mode 100644 (file)
index 0000000..a90ec69
--- /dev/null
@@ -0,0 +1,85 @@
+<script type="text/javascript">
+       // update pending count //
+       $(function(){
+               $("nav").bind('nav-update', function(e,data){
+                       var elm = $('#pending-update');
+                       var register = $(data).find('register').text();
+                       if (register=="0") { register = ""; }
+                       elm.html(register);
+               });
+       });
+</script>
+
+<div class="widget">
+       <h3><a href="{{$admurl}}">{{$admtxt}}</a></h3>
+
+       <ul role="menu">
+               {{foreach $subpages as $name => $item}}
+               <li role="menuitem" class="{{$item.2}}">
+                       <a href="{{$item.0}}" {{if $item.accesskey}}accesskey="{{$item.accesskey}}"{{/if}}>
+                               {{$item.1}}
+                               {{if $name == "users"}}
+                                <span id="pending-update" class="badge pull-right"></span>
+                               {{/if}}
+                       </a>
+               </li>
+               {{/foreach}}
+       </ul>
+
+       {{if $admin.update}}
+       <ul role="menu">
+               <li role="menuitem" class="{{$admin.update.2}}">
+                       <a href="{{$admin.update.0}}" {{if $admin.update.accesskey}}accesskey="{{$admin.update.accesskey}}"{{/if}}>
+                               {{$admin.update.1}}
+                       </a>
+               </li>
+       </ul>
+       {{/if}}
+</div>
+
+{{if $admin.plugins_admin}}
+<div class="widget">
+       <h3>{{$plugadmtxt}}</h3>
+       <ul role="menu">
+               {{foreach $admin.plugins_admin as $name => $item}}
+               <li role="menuitem" class="{{$item.2}}">
+                       <a href="{{$item.0}}" {{if $item.accesskey}}accesskey="{{$item.accesskey}}"{{/if}}>
+                               {{$item.1}}
+                       </a>
+               </li>
+               {{/foreach}}
+       </ul>
+</div>
+{{/if}}
+
+<div class="widget">
+       <h3>{{$logtxt}}</h3>
+       <ul role="menu">
+               <li role="menuitem" class="{{$admin.logs.2}}">
+                       <a href="{{$admin.logs.0}}" {{if $admin.logs.accesskey}}accesskey="{{$admin.logs.accesskey}}"{{/if}}>
+                               {{$admin.logs.1}}
+                       </a>
+               </li>
+               <li role="menuitem" class="{{$admin.viewlogs.2}}">
+                       <a href="{{$admin.viewlogs.0}}" {{if $admin.viewlogs.accesskey}}accesskey="{{$admin.viewlogs.accesskey}}"{{/if}}>
+                               {{$admin.viewlogs.1}}
+                       </a>
+               </li>
+       </ul>
+</div>
+
+<div class="widget">
+       <h3>{{$diagnosticstxt}}</h3>
+       <ul role="menu">
+               <li role="menuitem" class="{{$admin.diagnostics_probe.2}}">
+                       <a href="{{$admin.diagnostics_probe.0}}" {{if $admin.diagnostics_probe.accesskey}}accesskey="{{$admin.diagnostics_probe.accesskey}}"{{/if}}>
+                               {{$admin.diagnostics_probe.1}}
+                       </a>
+               </li>
+               <li role="menuitem" class="{{$admin.diagnostics_webfinger.2}}">
+                       <a href="{{$admin.diagnostics_webfinger.0}}" {{if $admin.viewlogs.accesskey}}accesskey="{{$admin.diagnostics_webfinger.accesskey}}"{{/if}}>
+                               {{$admin.diagnostics_webfinger.1}}
+                       </a>
+               </li>
+       </ul>
+</div>
diff --git a/view/theme/frio/templates/admin/contactblock.tpl b/view/theme/frio/templates/admin/contactblock.tpl
new file mode 100644 (file)
index 0000000..f330854
--- /dev/null
@@ -0,0 +1,60 @@
+<script type="text/javascript" src="view/theme/frio/js/mod_admin.js"></script>
+<div id="adminpage">
+       <h1>{{$title}} - {{$page}}</h1>
+       <p>{{$description}}</p>
+       <form action="{{$baseurl}}/admin/contactblock" method="post">
+        <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+
+               <h3>{{$h_contacts}}</h3>
+       {{if $contacts}}
+               <table id="contactblock" class="table table-condensed table-striped">
+                       <thead>
+                               <tr>
+                                       <th><input type="checkbox" class="select contacts_ckbx" data-select-class="contacts_ckbx" data-select-all="{{$select_all}}"  data-select-none="{{$select_none}}" title="{{$select_all}}"/></th>
+                                               {{foreach $th_contacts as $th}}
+                                       <th>
+                                               {{$th}}
+                                       </th>
+                                       {{/foreach}}
+                                       <th></th>
+                               </tr>
+                       </thead>
+                       <tbody>
+                               {{foreach $contacts as $contact}}
+                               <tr>
+                                       <td><input type="checkbox" class="contacts_ckbx" id="id_contact_{{$contact.id}}" name="contacts[]" value="{{$contact.id}}"/></td>
+                                       <td><img class="icon" src="{{$contact.micro}}" alt="{{$contact.nickname}}" title="{{$contact.addr}}"></td>
+                                       <td class="name">{{$contact.name}}</td>
+                                       <td class="addr" colspan="2"><a href="{{$contact.url}}" title="{{$contact.addr}}" >{{$contact.url}}</a></td>
+                               </tr>
+                               {{/foreach}}
+                       </tbody>
+                       <tfoot>
+                               <tr>
+                                       <td><input type="checkbox" class="select contacts_ckbx" data-select-class="contacts_ckbx" data-select-all="{{$select_all}}"  data-select-none="{{$select_none}}" title="{{$select_all}}"/></td>
+                                       <td colspan="3">
+                                               {{$total_contacts}}
+                                       </td>
+                               </tr>
+                       </tfoot>
+               </table>
+               <div class="submit"><button type="submit" class="btn btn-small btn-default" name="page_contactblock_unblock" value="1">{{$unblock|escape:'html'}}</button></div>
+               {{$paginate}}
+       {{else}}
+               <p>{{$no_data|escape:'html'}}</p>
+       {{/if}}
+       </form>
+
+       <h3>{{$h_newblock}}</h3>
+       <form action="{{$baseurl}}/admin/contactblock" method="post">
+               <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+               <table id="contactblock">
+                       <tbody>
+                               <tr>
+                                       <td>{{include file="field_input.tpl" field=$contacturl}}</td>
+                               </tr>
+                       </tbody>
+               </table>
+               <div class="submit"><button type="submit" class="btn btn-primary" name="page_contactblock_block" value="1">{{$submit|escape:'html'}}</button></div>
+       </form>
+</div>
diff --git a/view/theme/frio/templates/admin_aside.tpl b/view/theme/frio/templates/admin_aside.tpl
deleted file mode 100644 (file)
index a90ec69..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<script type="text/javascript">
-       // update pending count //
-       $(function(){
-               $("nav").bind('nav-update', function(e,data){
-                       var elm = $('#pending-update');
-                       var register = $(data).find('register').text();
-                       if (register=="0") { register = ""; }
-                       elm.html(register);
-               });
-       });
-</script>
-
-<div class="widget">
-       <h3><a href="{{$admurl}}">{{$admtxt}}</a></h3>
-
-       <ul role="menu">
-               {{foreach $subpages as $name => $item}}
-               <li role="menuitem" class="{{$item.2}}">
-                       <a href="{{$item.0}}" {{if $item.accesskey}}accesskey="{{$item.accesskey}}"{{/if}}>
-                               {{$item.1}}
-                               {{if $name == "users"}}
-                                <span id="pending-update" class="badge pull-right"></span>
-                               {{/if}}
-                       </a>
-               </li>
-               {{/foreach}}
-       </ul>
-
-       {{if $admin.update}}
-       <ul role="menu">
-               <li role="menuitem" class="{{$admin.update.2}}">
-                       <a href="{{$admin.update.0}}" {{if $admin.update.accesskey}}accesskey="{{$admin.update.accesskey}}"{{/if}}>
-                               {{$admin.update.1}}
-                       </a>
-               </li>
-       </ul>
-       {{/if}}
-</div>
-
-{{if $admin.plugins_admin}}
-<div class="widget">
-       <h3>{{$plugadmtxt}}</h3>
-       <ul role="menu">
-               {{foreach $admin.plugins_admin as $name => $item}}
-               <li role="menuitem" class="{{$item.2}}">
-                       <a href="{{$item.0}}" {{if $item.accesskey}}accesskey="{{$item.accesskey}}"{{/if}}>
-                               {{$item.1}}
-                       </a>
-               </li>
-               {{/foreach}}
-       </ul>
-</div>
-{{/if}}
-
-<div class="widget">
-       <h3>{{$logtxt}}</h3>
-       <ul role="menu">
-               <li role="menuitem" class="{{$admin.logs.2}}">
-                       <a href="{{$admin.logs.0}}" {{if $admin.logs.accesskey}}accesskey="{{$admin.logs.accesskey}}"{{/if}}>
-                               {{$admin.logs.1}}
-                       </a>
-               </li>
-               <li role="menuitem" class="{{$admin.viewlogs.2}}">
-                       <a href="{{$admin.viewlogs.0}}" {{if $admin.viewlogs.accesskey}}accesskey="{{$admin.viewlogs.accesskey}}"{{/if}}>
-                               {{$admin.viewlogs.1}}
-                       </a>
-               </li>
-       </ul>
-</div>
-
-<div class="widget">
-       <h3>{{$diagnosticstxt}}</h3>
-       <ul role="menu">
-               <li role="menuitem" class="{{$admin.diagnostics_probe.2}}">
-                       <a href="{{$admin.diagnostics_probe.0}}" {{if $admin.diagnostics_probe.accesskey}}accesskey="{{$admin.diagnostics_probe.accesskey}}"{{/if}}>
-                               {{$admin.diagnostics_probe.1}}
-                       </a>
-               </li>
-               <li role="menuitem" class="{{$admin.diagnostics_webfinger.2}}">
-                       <a href="{{$admin.diagnostics_webfinger.0}}" {{if $admin.viewlogs.accesskey}}accesskey="{{$admin.diagnostics_webfinger.accesskey}}"{{/if}}>
-                               {{$admin.diagnostics_webfinger.1}}
-                       </a>
-               </li>
-       </ul>
-</div>
diff --git a/view/theme/frost-mobile/templates/admin/aside.tpl b/view/theme/frost-mobile/templates/admin/aside.tpl
new file mode 100644 (file)
index 0000000..74b6cd5
--- /dev/null
@@ -0,0 +1,32 @@
+
+
+<h4><a href="{{$admurl}}">{{$admtxt}}</a></h4>
+<ul class='admin linklist'>
+       <li class='admin button {{$admin.site.2}}'><a href='{{$admin.site.0}}'>{{$admin.site.1}}</a></li>
+       <li class='admin button {{$admin.users.2}}'><a href='{{$admin.users.0}}'>{{$admin.users.1}}</a><span id='pending-update' title='{{$h_pending}}'></span></li>
+       <li class='admin button {{$admin.plugins.2}}'><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
+       <li class='admin button {{$admin.themes.2}}'><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
+       <li class='admin button {{$admin.dbsync.2}}'><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
+</ul>
+
+{{if $admin.update}}
+<ul class='admin linklist'>
+       <li class='admin button {{$admin.update.2}}'><a href='{{$admin.update.0}}'>{{$admin.update.1}}</a></li>
+       <li class='admin button {{$admin.update.2}}'><a href='https://kakste.com/profile/inthegit'>Important Changes</a></li>
+</ul>
+{{/if}}
+
+
+{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
+<ul class='admin linklist'>
+       {{foreach $admin.plugins_admin as $l}}
+       <li class='admin button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
+       {{/foreach}}
+</ul>
+       
+       
+<h4>{{$logtxt}}</h4>
+<ul class='admin linklist'>
+       <li class='admin button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
+</ul>
+
diff --git a/view/theme/frost-mobile/templates/admin/site.tpl b/view/theme/frost-mobile/templates/admin/site.tpl
new file mode 100644 (file)
index 0000000..d5b64e5
--- /dev/null
@@ -0,0 +1,65 @@
+
+
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <form action="{{$baseurl}}/admin/site" method="post">
+    <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+
+       {{include file="field_input.tpl" field=$sitename}}
+       {{include file="field_textarea.tpl" field=$banner}}
+       {{include file="field_select.tpl" field=$language}}
+       {{include file="field_select.tpl" field=$theme}}
+       {{include file="field_select.tpl" field=$theme_mobile}}
+       {{include file="field_select.tpl" field=$ssl_policy}}
+       {{include file="field_checkbox.tpl" field=$old_share}}
+       {{include file="field_checkbox.tpl" field=$hide_help}} 
+       {{include file="field_select.tpl" field=$singleuser}} 
+       
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+       
+       <h3>{{$registration}}</h3>
+       {{include file="field_input.tpl" field=$register_text}}
+       {{include file="field_select.tpl" field=$register_policy}}
+       
+       {{include file="field_checkbox.tpl" field=$no_multi_reg}}
+       {{include file="field_checkbox.tpl" field=$no_openid}}
+       {{include file="field_checkbox.tpl" field=$no_regfullname}}
+       
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+
+       <h3>{{$upload}}</h3>
+       {{include file="field_input.tpl" field=$maximagesize}}
+       {{include file="field_input.tpl" field=$maximagelength}}
+       {{include file="field_input.tpl" field=$jpegimagequality}}
+       
+       <h3>{{$corporate}}</h3>
+       {{include file="field_input.tpl" field=$allowed_sites}}
+       {{include file="field_input.tpl" field=$allowed_email}}
+       {{include file="field_checkbox.tpl" field=$block_public}}
+       {{include file="field_checkbox.tpl" field=$force_publish}}
+       {{include file="field_checkbox.tpl" field=$no_community_page}}
+       {{include file="field_checkbox.tpl" field=$ostatus_disabled}}
+       {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
+       {{include file="field_checkbox.tpl" field=$dfrn_only}}
+       {{include file="field_input.tpl" field=$global_directory}}
+       {{include file="field_checkbox.tpl" field=$newuser_private}}
+       {{include file="field_checkbox.tpl" field=$enotify_no_content}}
+       {{include file="field_checkbox.tpl" field=$private_addons}}     
+       {{include file="field_checkbox.tpl" field=$disable_embedded}}   
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+       
+       <h3>{{$advanced}}</h3>
+       {{include file="field_checkbox.tpl" field=$verifyssl}}
+       {{include file="field_input.tpl" field=$proxy}}
+       {{include file="field_input.tpl" field=$proxyuser}}
+       {{include file="field_input.tpl" field=$timeout}}
+       {{include file="field_input.tpl" field=$delivery_interval}}
+       {{include file="field_input.tpl" field=$poll_interval}}
+       {{include file="field_input.tpl" field=$maxloadavg}}
+       {{include file="field_input.tpl" field=$abandon_days}}
+       
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+       
+       </form>
+</div>
diff --git a/view/theme/frost-mobile/templates/admin/users.tpl b/view/theme/frost-mobile/templates/admin/users.tpl
new file mode 100644 (file)
index 0000000..f0c4869
--- /dev/null
@@ -0,0 +1,98 @@
+<script>
+       function confirm_delete(uname){
+               return confirm( "{{$confirm_delete}}".format(uname));
+       }
+       function confirm_delete_multi(){
+               return confirm("{{$confirm_delete_multi}}");
+       }
+       function selectall(cls){
+               $("."+cls).attr('checked','checked');
+               return false;
+       }
+</script>
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <form action="{{$baseurl}}/admin/users" method="post">
+        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+               
+               <h3>{{$h_pending}}</h3>
+               {{if $pending}}
+                       <table id='pending'>
+                               <thead>
+                               <tr>
+                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                       {{foreach $pending as $u}}
+                               <tr>
+                                       <td class="created">{{$u.created}}</td>
+                                       <td class="name">{{$u.name}}</td>
+                                       <td class="email">{{$u.email}}</td>
+                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
+                                       <td class="tools">
+                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='tool like'></span></a>
+                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='tool dislike'></span></a>
+                                       </td>
+                               </tr>
+                       {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>                        
+               {{else}}
+                       <p>{{$no_pending}}</p>
+               {{/if}}
+       
+       
+               
+       
+               <h3>{{$h_users}}</h3>
+               {{if $users}}
+                       <table id='users'>
+                               <thead>
+                               <tr>
+                                       <th></th>
+                                       {{foreach $th_users as $th}}<th>{{$th}}</th>{{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                               {{foreach $users as $u}}
+                                       <tr>
+                                               <td><img src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
+                                               <td class='email'>{{$u.email}}</td>
+                                               <td class='register_date'>{{$u.register_date}}</td>
+                                               <td class='login_date'>{{$u.login_date}}</td>
+                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
+                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
+                                               <td class="checkbox"> 
+                                    {{if $u.is_admin}}
+                                        &nbsp;
+                                    {{else}}
+                                        <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
+                                    {{/if}}
+                                               <td class="tools">
+                                    {{if $u.is_admin}}
+                                        &nbsp;
+                                    {{else}}
+                                        <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>
+                                        <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon drop'></span></a>
+                                    {{/if}}
+                                               </td>
+                                       </tr>
+                               {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div>                                          
+               {{else}}
+                       NO USERS?!?
+               {{/if}}
+       </form>
+</div>
diff --git a/view/theme/frost-mobile/templates/admin_aside.tpl b/view/theme/frost-mobile/templates/admin_aside.tpl
deleted file mode 100644 (file)
index 74b6cd5..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-<h4><a href="{{$admurl}}">{{$admtxt}}</a></h4>
-<ul class='admin linklist'>
-       <li class='admin button {{$admin.site.2}}'><a href='{{$admin.site.0}}'>{{$admin.site.1}}</a></li>
-       <li class='admin button {{$admin.users.2}}'><a href='{{$admin.users.0}}'>{{$admin.users.1}}</a><span id='pending-update' title='{{$h_pending}}'></span></li>
-       <li class='admin button {{$admin.plugins.2}}'><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
-       <li class='admin button {{$admin.themes.2}}'><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
-       <li class='admin button {{$admin.dbsync.2}}'><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
-</ul>
-
-{{if $admin.update}}
-<ul class='admin linklist'>
-       <li class='admin button {{$admin.update.2}}'><a href='{{$admin.update.0}}'>{{$admin.update.1}}</a></li>
-       <li class='admin button {{$admin.update.2}}'><a href='https://kakste.com/profile/inthegit'>Important Changes</a></li>
-</ul>
-{{/if}}
-
-
-{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
-<ul class='admin linklist'>
-       {{foreach $admin.plugins_admin as $l}}
-       <li class='admin button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
-       {{/foreach}}
-</ul>
-       
-       
-<h4>{{$logtxt}}</h4>
-<ul class='admin linklist'>
-       <li class='admin button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
-</ul>
-
diff --git a/view/theme/frost-mobile/templates/admin_site.tpl b/view/theme/frost-mobile/templates/admin_site.tpl
deleted file mode 100644 (file)
index d5b64e5..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <form action="{{$baseurl}}/admin/site" method="post">
-    <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-
-       {{include file="field_input.tpl" field=$sitename}}
-       {{include file="field_textarea.tpl" field=$banner}}
-       {{include file="field_select.tpl" field=$language}}
-       {{include file="field_select.tpl" field=$theme}}
-       {{include file="field_select.tpl" field=$theme_mobile}}
-       {{include file="field_select.tpl" field=$ssl_policy}}
-       {{include file="field_checkbox.tpl" field=$old_share}}
-       {{include file="field_checkbox.tpl" field=$hide_help}} 
-       {{include file="field_select.tpl" field=$singleuser}} 
-       
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-       
-       <h3>{{$registration}}</h3>
-       {{include file="field_input.tpl" field=$register_text}}
-       {{include file="field_select.tpl" field=$register_policy}}
-       
-       {{include file="field_checkbox.tpl" field=$no_multi_reg}}
-       {{include file="field_checkbox.tpl" field=$no_openid}}
-       {{include file="field_checkbox.tpl" field=$no_regfullname}}
-       
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-
-       <h3>{{$upload}}</h3>
-       {{include file="field_input.tpl" field=$maximagesize}}
-       {{include file="field_input.tpl" field=$maximagelength}}
-       {{include file="field_input.tpl" field=$jpegimagequality}}
-       
-       <h3>{{$corporate}}</h3>
-       {{include file="field_input.tpl" field=$allowed_sites}}
-       {{include file="field_input.tpl" field=$allowed_email}}
-       {{include file="field_checkbox.tpl" field=$block_public}}
-       {{include file="field_checkbox.tpl" field=$force_publish}}
-       {{include file="field_checkbox.tpl" field=$no_community_page}}
-       {{include file="field_checkbox.tpl" field=$ostatus_disabled}}
-       {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
-       {{include file="field_checkbox.tpl" field=$dfrn_only}}
-       {{include file="field_input.tpl" field=$global_directory}}
-       {{include file="field_checkbox.tpl" field=$newuser_private}}
-       {{include file="field_checkbox.tpl" field=$enotify_no_content}}
-       {{include file="field_checkbox.tpl" field=$private_addons}}     
-       {{include file="field_checkbox.tpl" field=$disable_embedded}}   
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-       
-       <h3>{{$advanced}}</h3>
-       {{include file="field_checkbox.tpl" field=$verifyssl}}
-       {{include file="field_input.tpl" field=$proxy}}
-       {{include file="field_input.tpl" field=$proxyuser}}
-       {{include file="field_input.tpl" field=$timeout}}
-       {{include file="field_input.tpl" field=$delivery_interval}}
-       {{include file="field_input.tpl" field=$poll_interval}}
-       {{include file="field_input.tpl" field=$maxloadavg}}
-       {{include file="field_input.tpl" field=$abandon_days}}
-       
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-       
-       </form>
-</div>
diff --git a/view/theme/frost-mobile/templates/admin_users.tpl b/view/theme/frost-mobile/templates/admin_users.tpl
deleted file mode 100644 (file)
index f0c4869..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<script>
-       function confirm_delete(uname){
-               return confirm( "{{$confirm_delete}}".format(uname));
-       }
-       function confirm_delete_multi(){
-               return confirm("{{$confirm_delete_multi}}");
-       }
-       function selectall(cls){
-               $("."+cls).attr('checked','checked');
-               return false;
-       }
-</script>
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <form action="{{$baseurl}}/admin/users" method="post">
-        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-               
-               <h3>{{$h_pending}}</h3>
-               {{if $pending}}
-                       <table id='pending'>
-                               <thead>
-                               <tr>
-                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                       {{foreach $pending as $u}}
-                               <tr>
-                                       <td class="created">{{$u.created}}</td>
-                                       <td class="name">{{$u.name}}</td>
-                                       <td class="email">{{$u.email}}</td>
-                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
-                                       <td class="tools">
-                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='tool like'></span></a>
-                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='tool dislike'></span></a>
-                                       </td>
-                               </tr>
-                       {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>                        
-               {{else}}
-                       <p>{{$no_pending}}</p>
-               {{/if}}
-       
-       
-               
-       
-               <h3>{{$h_users}}</h3>
-               {{if $users}}
-                       <table id='users'>
-                               <thead>
-                               <tr>
-                                       <th></th>
-                                       {{foreach $th_users as $th}}<th>{{$th}}</th>{{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                               {{foreach $users as $u}}
-                                       <tr>
-                                               <td><img src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
-                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
-                                               <td class='email'>{{$u.email}}</td>
-                                               <td class='register_date'>{{$u.register_date}}</td>
-                                               <td class='login_date'>{{$u.login_date}}</td>
-                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
-                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
-                                               <td class="checkbox"> 
-                                    {{if $u.is_admin}}
-                                        &nbsp;
-                                    {{else}}
-                                        <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
-                                    {{/if}}
-                                               <td class="tools">
-                                    {{if $u.is_admin}}
-                                        &nbsp;
-                                    {{else}}
-                                        <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>
-                                        <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon drop'></span></a>
-                                    {{/if}}
-                                               </td>
-                                       </tr>
-                               {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div>                                          
-               {{else}}
-                       NO USERS?!?
-               {{/if}}
-       </form>
-</div>
diff --git a/view/theme/frost/templates/admin/aside.tpl b/view/theme/frost/templates/admin/aside.tpl
new file mode 100644 (file)
index 0000000..74b6cd5
--- /dev/null
@@ -0,0 +1,32 @@
+
+
+<h4><a href="{{$admurl}}">{{$admtxt}}</a></h4>
+<ul class='admin linklist'>
+       <li class='admin button {{$admin.site.2}}'><a href='{{$admin.site.0}}'>{{$admin.site.1}}</a></li>
+       <li class='admin button {{$admin.users.2}}'><a href='{{$admin.users.0}}'>{{$admin.users.1}}</a><span id='pending-update' title='{{$h_pending}}'></span></li>
+       <li class='admin button {{$admin.plugins.2}}'><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
+       <li class='admin button {{$admin.themes.2}}'><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
+       <li class='admin button {{$admin.dbsync.2}}'><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
+</ul>
+
+{{if $admin.update}}
+<ul class='admin linklist'>
+       <li class='admin button {{$admin.update.2}}'><a href='{{$admin.update.0}}'>{{$admin.update.1}}</a></li>
+       <li class='admin button {{$admin.update.2}}'><a href='https://kakste.com/profile/inthegit'>Important Changes</a></li>
+</ul>
+{{/if}}
+
+
+{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
+<ul class='admin linklist'>
+       {{foreach $admin.plugins_admin as $l}}
+       <li class='admin button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
+       {{/foreach}}
+</ul>
+       
+       
+<h4>{{$logtxt}}</h4>
+<ul class='admin linklist'>
+       <li class='admin button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
+</ul>
+
diff --git a/view/theme/frost/templates/admin/site.tpl b/view/theme/frost/templates/admin/site.tpl
new file mode 100644 (file)
index 0000000..8dcfa91
--- /dev/null
@@ -0,0 +1,73 @@
+
+
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <form action="{{$baseurl}}/admin/site" method="post">
+    <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+
+       {{include file="field_input.tpl" field=$sitename}}
+       {{include file="field_textarea.tpl" field=$banner}}
+       {{include file="field_select.tpl" field=$language}}
+       {{include file="field_select.tpl" field=$theme}}
+       {{include file="field_select.tpl" field=$theme_mobile}}
+       {{include file="field_select.tpl" field=$ssl_policy}}
+       {{include file="field_checkbox.tpl" field=$old_share}}
+       {{include file="field_checkbox.tpl" field=$hide_help}} 
+       {{include file="field_select.tpl" field=$singleuser}}
+       
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+       
+       <h3>{{$registration}}</h3>
+       {{include file="field_input.tpl" field=$register_text}}
+       {{include file="field_select.tpl" field=$register_policy}}
+       {{include file="field_input.tpl" field=$daily_registrations}}
+       {{include file="field_checkbox.tpl" field=$no_multi_reg}}
+       {{include file="field_checkbox.tpl" field=$no_openid}}
+       {{include file="field_checkbox.tpl" field=$no_regfullname}}
+       
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+
+       <h3>{{$upload}}</h3>
+       {{include file="field_input.tpl" field=$maximagesize}}
+       {{include file="field_input.tpl" field=$maximagelength}}
+       {{include file="field_input.tpl" field=$jpegimagequality}}
+       
+       <h3>{{$corporate}}</h3>
+       {{include file="field_input.tpl" field=$allowed_sites}}
+       {{include file="field_input.tpl" field=$allowed_email}}
+       {{include file="field_checkbox.tpl" field=$block_public}}
+       {{include file="field_checkbox.tpl" field=$force_publish}}
+       {{include file="field_checkbox.tpl" field=$no_community_page}}
+       {{include file="field_checkbox.tpl" field=$ostatus_disabled}}
+       {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
+       {{include file="field_checkbox.tpl" field=$dfrn_only}}
+       {{include file="field_input.tpl" field=$global_directory}}
+       {{include file="field_checkbox.tpl" field=$newuser_private}}
+       {{include file="field_checkbox.tpl" field=$enotify_no_content}}
+       {{include file="field_checkbox.tpl" field=$private_addons}}     
+       {{include file="field_checkbox.tpl" field=$disable_embedded}}   
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+       
+       <h3>{{$advanced}}</h3>
+       {{include file="field_checkbox.tpl" field=$verifyssl}}
+       {{include file="field_input.tpl" field=$proxy}}
+       {{include file="field_input.tpl" field=$proxyuser}}
+       {{include file="field_input.tpl" field=$timeout}}
+       {{include file="field_input.tpl" field=$delivery_interval}}
+       {{include file="field_input.tpl" field=$poll_interval}}
+       {{include file="field_input.tpl" field=$maxloadavg}}
+       {{include file="field_input.tpl" field=$abandon_days}}
+       {{include file="field_input.tpl" field=$lockpath}}
+       {{include file="field_input.tpl" field=$temppath}}
+       {{include file="field_input.tpl" field=$basepath}}
+
+       <h3>{{$performance}}</h3>
+       {{include file="field_input.tpl" field=$itemcache}}
+       {{include file="field_input.tpl" field=$itemcache_duration}}
+
+       
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
+       
+       </form>
+</div>
diff --git a/view/theme/frost/templates/admin/users.tpl b/view/theme/frost/templates/admin/users.tpl
new file mode 100644 (file)
index 0000000..f0c4869
--- /dev/null
@@ -0,0 +1,98 @@
+<script>
+       function confirm_delete(uname){
+               return confirm( "{{$confirm_delete}}".format(uname));
+       }
+       function confirm_delete_multi(){
+               return confirm("{{$confirm_delete_multi}}");
+       }
+       function selectall(cls){
+               $("."+cls).attr('checked','checked');
+               return false;
+       }
+</script>
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <form action="{{$baseurl}}/admin/users" method="post">
+        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+               
+               <h3>{{$h_pending}}</h3>
+               {{if $pending}}
+                       <table id='pending'>
+                               <thead>
+                               <tr>
+                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                       {{foreach $pending as $u}}
+                               <tr>
+                                       <td class="created">{{$u.created}}</td>
+                                       <td class="name">{{$u.name}}</td>
+                                       <td class="email">{{$u.email}}</td>
+                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
+                                       <td class="tools">
+                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='tool like'></span></a>
+                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='tool dislike'></span></a>
+                                       </td>
+                               </tr>
+                       {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>                        
+               {{else}}
+                       <p>{{$no_pending}}</p>
+               {{/if}}
+       
+       
+               
+       
+               <h3>{{$h_users}}</h3>
+               {{if $users}}
+                       <table id='users'>
+                               <thead>
+                               <tr>
+                                       <th></th>
+                                       {{foreach $th_users as $th}}<th>{{$th}}</th>{{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                               {{foreach $users as $u}}
+                                       <tr>
+                                               <td><img src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
+                                               <td class='email'>{{$u.email}}</td>
+                                               <td class='register_date'>{{$u.register_date}}</td>
+                                               <td class='login_date'>{{$u.login_date}}</td>
+                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
+                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
+                                               <td class="checkbox"> 
+                                    {{if $u.is_admin}}
+                                        &nbsp;
+                                    {{else}}
+                                        <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
+                                    {{/if}}
+                                               <td class="tools">
+                                    {{if $u.is_admin}}
+                                        &nbsp;
+                                    {{else}}
+                                        <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>
+                                        <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon drop'></span></a>
+                                    {{/if}}
+                                               </td>
+                                       </tr>
+                               {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div>                                          
+               {{else}}
+                       NO USERS?!?
+               {{/if}}
+       </form>
+</div>
diff --git a/view/theme/frost/templates/admin_aside.tpl b/view/theme/frost/templates/admin_aside.tpl
deleted file mode 100644 (file)
index 74b6cd5..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-<h4><a href="{{$admurl}}">{{$admtxt}}</a></h4>
-<ul class='admin linklist'>
-       <li class='admin button {{$admin.site.2}}'><a href='{{$admin.site.0}}'>{{$admin.site.1}}</a></li>
-       <li class='admin button {{$admin.users.2}}'><a href='{{$admin.users.0}}'>{{$admin.users.1}}</a><span id='pending-update' title='{{$h_pending}}'></span></li>
-       <li class='admin button {{$admin.plugins.2}}'><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
-       <li class='admin button {{$admin.themes.2}}'><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
-       <li class='admin button {{$admin.dbsync.2}}'><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
-</ul>
-
-{{if $admin.update}}
-<ul class='admin linklist'>
-       <li class='admin button {{$admin.update.2}}'><a href='{{$admin.update.0}}'>{{$admin.update.1}}</a></li>
-       <li class='admin button {{$admin.update.2}}'><a href='https://kakste.com/profile/inthegit'>Important Changes</a></li>
-</ul>
-{{/if}}
-
-
-{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
-<ul class='admin linklist'>
-       {{foreach $admin.plugins_admin as $l}}
-       <li class='admin button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
-       {{/foreach}}
-</ul>
-       
-       
-<h4>{{$logtxt}}</h4>
-<ul class='admin linklist'>
-       <li class='admin button {{$admin.logs.2}}'><a href='{{$admin.logs.0}}'>{{$admin.logs.1}}</a></li>
-</ul>
-
diff --git a/view/theme/frost/templates/admin_site.tpl b/view/theme/frost/templates/admin_site.tpl
deleted file mode 100644 (file)
index 8dcfa91..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <form action="{{$baseurl}}/admin/site" method="post">
-    <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-
-       {{include file="field_input.tpl" field=$sitename}}
-       {{include file="field_textarea.tpl" field=$banner}}
-       {{include file="field_select.tpl" field=$language}}
-       {{include file="field_select.tpl" field=$theme}}
-       {{include file="field_select.tpl" field=$theme_mobile}}
-       {{include file="field_select.tpl" field=$ssl_policy}}
-       {{include file="field_checkbox.tpl" field=$old_share}}
-       {{include file="field_checkbox.tpl" field=$hide_help}} 
-       {{include file="field_select.tpl" field=$singleuser}}
-       
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-       
-       <h3>{{$registration}}</h3>
-       {{include file="field_input.tpl" field=$register_text}}
-       {{include file="field_select.tpl" field=$register_policy}}
-       {{include file="field_input.tpl" field=$daily_registrations}}
-       {{include file="field_checkbox.tpl" field=$no_multi_reg}}
-       {{include file="field_checkbox.tpl" field=$no_openid}}
-       {{include file="field_checkbox.tpl" field=$no_regfullname}}
-       
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-
-       <h3>{{$upload}}</h3>
-       {{include file="field_input.tpl" field=$maximagesize}}
-       {{include file="field_input.tpl" field=$maximagelength}}
-       {{include file="field_input.tpl" field=$jpegimagequality}}
-       
-       <h3>{{$corporate}}</h3>
-       {{include file="field_input.tpl" field=$allowed_sites}}
-       {{include file="field_input.tpl" field=$allowed_email}}
-       {{include file="field_checkbox.tpl" field=$block_public}}
-       {{include file="field_checkbox.tpl" field=$force_publish}}
-       {{include file="field_checkbox.tpl" field=$no_community_page}}
-       {{include file="field_checkbox.tpl" field=$ostatus_disabled}}
-       {{include file="field_checkbox.tpl" field=$diaspora_enabled}}
-       {{include file="field_checkbox.tpl" field=$dfrn_only}}
-       {{include file="field_input.tpl" field=$global_directory}}
-       {{include file="field_checkbox.tpl" field=$newuser_private}}
-       {{include file="field_checkbox.tpl" field=$enotify_no_content}}
-       {{include file="field_checkbox.tpl" field=$private_addons}}     
-       {{include file="field_checkbox.tpl" field=$disable_embedded}}   
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-       
-       <h3>{{$advanced}}</h3>
-       {{include file="field_checkbox.tpl" field=$verifyssl}}
-       {{include file="field_input.tpl" field=$proxy}}
-       {{include file="field_input.tpl" field=$proxyuser}}
-       {{include file="field_input.tpl" field=$timeout}}
-       {{include file="field_input.tpl" field=$delivery_interval}}
-       {{include file="field_input.tpl" field=$poll_interval}}
-       {{include file="field_input.tpl" field=$maxloadavg}}
-       {{include file="field_input.tpl" field=$abandon_days}}
-       {{include file="field_input.tpl" field=$lockpath}}
-       {{include file="field_input.tpl" field=$temppath}}
-       {{include file="field_input.tpl" field=$basepath}}
-
-       <h3>{{$performance}}</h3>
-       {{include file="field_input.tpl" field=$itemcache}}
-       {{include file="field_input.tpl" field=$itemcache_duration}}
-
-       
-       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
-       
-       </form>
-</div>
diff --git a/view/theme/frost/templates/admin_users.tpl b/view/theme/frost/templates/admin_users.tpl
deleted file mode 100644 (file)
index f0c4869..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<script>
-       function confirm_delete(uname){
-               return confirm( "{{$confirm_delete}}".format(uname));
-       }
-       function confirm_delete_multi(){
-               return confirm("{{$confirm_delete_multi}}");
-       }
-       function selectall(cls){
-               $("."+cls).attr('checked','checked');
-               return false;
-       }
-</script>
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <form action="{{$baseurl}}/admin/users" method="post">
-        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-               
-               <h3>{{$h_pending}}</h3>
-               {{if $pending}}
-                       <table id='pending'>
-                               <thead>
-                               <tr>
-                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                       {{foreach $pending as $u}}
-                               <tr>
-                                       <td class="created">{{$u.created}}</td>
-                                       <td class="name">{{$u.name}}</td>
-                                       <td class="email">{{$u.email}}</td>
-                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
-                                       <td class="tools">
-                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='tool like'></span></a>
-                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='tool dislike'></span></a>
-                                       </td>
-                               </tr>
-                       {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>                        
-               {{else}}
-                       <p>{{$no_pending}}</p>
-               {{/if}}
-       
-       
-               
-       
-               <h3>{{$h_users}}</h3>
-               {{if $users}}
-                       <table id='users'>
-                               <thead>
-                               <tr>
-                                       <th></th>
-                                       {{foreach $th_users as $th}}<th>{{$th}}</th>{{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                               {{foreach $users as $u}}
-                                       <tr>
-                                               <td><img src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
-                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
-                                               <td class='email'>{{$u.email}}</td>
-                                               <td class='register_date'>{{$u.register_date}}</td>
-                                               <td class='login_date'>{{$u.login_date}}</td>
-                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
-                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
-                                               <td class="checkbox"> 
-                                    {{if $u.is_admin}}
-                                        &nbsp;
-                                    {{else}}
-                                        <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
-                                    {{/if}}
-                                               <td class="tools">
-                                    {{if $u.is_admin}}
-                                        &nbsp;
-                                    {{else}}
-                                        <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>
-                                        <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon drop'></span></a>
-                                    {{/if}}
-                                               </td>
-                                       </tr>
-                               {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div>                                          
-               {{else}}
-                       NO USERS?!?
-               {{/if}}
-       </form>
-</div>
diff --git a/view/theme/quattro/templates/admin/users.tpl b/view/theme/quattro/templates/admin/users.tpl
new file mode 100644 (file)
index 0000000..ddb395d
--- /dev/null
@@ -0,0 +1,155 @@
+
+<script>
+       function confirm_delete(uname){
+               return confirm( "{{$confirm_delete}}".format(uname));
+       }
+       function confirm_delete_multi(){
+               return confirm("{{$confirm_delete_multi}}");
+       }
+       function selectall(cls){
+               $("."+cls).attr('checked','checked');
+               return false;
+       }
+</script>
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+       
+       <form action="{{$baseurl}}/admin/users" method="post">
+        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
+               
+               <h3>{{$h_pending}}</h3>
+               {{if $pending}}
+                       <table id='pending'>
+                               <thead>
+                               <tr>
+                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                       {{foreach $pending as $u}}
+                               <tr>
+                                       <td class="created">{{$u.created}}</td>
+                                       <td class="name">{{$u.name}}</td>
+                                       <td class="email">{{$u.email}}</td>
+                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
+                                       <td class="tools">
+                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='icon like'></span></a>
+                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='icon dislike'></span></a>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td class="pendingnote"><p><span>{{$pendingnotetext}}:</span> {{$u.note}}</p></td>
+                               </tr>
+                       {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>                        
+               {{else}}
+                       <p>{{$no_pending}}</p>
+               {{/if}}
+       
+               <h3>{{$h_users}}</h3>
+               {{if $users}}
+                       <table id='users'>
+                               <thead>
+                               <tr>
+                                       <th></th>
+                                       {{foreach $th_users as $th}}
+                                       <th>
+                                               <a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}">
+                                                       {{if $order_users == $th.1}}
+                                                               {{if $order_direction_users == "+"}}
+                                                               &#8595;
+                                                               {{else}}
+                                                               &#8593;
+                                                               {{/if}}
+                                                       {{else}}
+                                                               &#8597;
+                                                       {{/if}}
+                                               {{$th.0}}</a>
+                                       </th>
+                                       {{/foreach}}
+                                       <th></th>
+                                       <th></th>
+                               </tr>
+                               </thead>
+                               <tbody>
+                               {{foreach $users as $u}}
+                                       <tr>
+                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
+                                               <td class='email'>{{$u.email}}</td>
+                                               <td class='register_date'>{{$u.register_date}}</td>
+                                               <td class='login_date'>{{$u.login_date}}</td>
+                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
+                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
+                                               <td class="checkbox"> 
+                                               {{if $u.is_deletable}}
+                                                       <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
+                                               {{else}}
+                                                       &nbsp;
+                                               {{/if}}
+                                               <td class="tools">
+                                               {{if $u.is_deletable}}
+                                                       <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon {{if $u.blocked==0}}unlock{{else}}lock{{/if}}'></span></a>
+                                                       <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon delete'></span></a>
+                                               {{else}}
+                                                       &nbsp;
+                                               {{/if}}
+                                               </td>
+                                       </tr>
+                               {{/foreach}}
+                               </tbody>
+                       </table>
+                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
+                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div>                                          
+               {{else}}
+                       NO USERS?!?
+               {{/if}}
+       </form>
+       {{if $deleted}}
+               <h3>{{$h_deleted}}</h3>
+                       <table id='deleted'>
+                               <thead>
+                               <tr>
+                                       <th></th>
+                                       {{foreach $th_deleted as $th}}<th>{{$th}}</th>{{/foreach}}
+                               </tr>
+                               </thead>
+                               <tbody>
+                               {{foreach $deleted as $u}}
+                                       <tr>
+                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
+                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
+                                               <td class='email'>{{$u.email}}</td>
+                                               <td class='register_date'>{{$u.register_date}}</td>
+                                               <td class='login_date'>{{$u.login_date}}</td>
+                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
+                                               <td class='login_date'>{{$u.deleted}}</td>
+                                       </tr>
+                               {{/foreach}}
+                               </tbody>
+                       </table>
+               {{/if}}
+  <h3>{{$h_newuser}}</h3> 
+  <form action="{{$baseurl}}/admin/users" method="post"> 
+  <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> 
+  <table id='users'> 
+      <tbody> 
+        <tr> 
+        <td>{{include file="field_input.tpl" field=$newusername}}</td> 
+    </tr> 
+        <tr> 
+        <td>{{include file="field_input.tpl" field=$newusernickname}}</td> 
+    </tr> 
+        <tr> 
+        <td>{{include file="field_input.tpl" field=$newuseremail}}</td> 
+    </tr> 
+      </tbody> 
+  </table> 
+  <div class="submit"><input type="submit" name="add_new_user_submit" value="{{$submit}}" /></div>             
+  </form>
+</div>
diff --git a/view/theme/quattro/templates/admin_users.tpl b/view/theme/quattro/templates/admin_users.tpl
deleted file mode 100644 (file)
index ddb395d..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-
-<script>
-       function confirm_delete(uname){
-               return confirm( "{{$confirm_delete}}".format(uname));
-       }
-       function confirm_delete_multi(){
-               return confirm("{{$confirm_delete_multi}}");
-       }
-       function selectall(cls){
-               $("."+cls).attr('checked','checked');
-               return false;
-       }
-</script>
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-       
-       <form action="{{$baseurl}}/admin/users" method="post">
-        <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
-               
-               <h3>{{$h_pending}}</h3>
-               {{if $pending}}
-                       <table id='pending'>
-                               <thead>
-                               <tr>
-                                       {{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                       {{foreach $pending as $u}}
-                               <tr>
-                                       <td class="created">{{$u.created}}</td>
-                                       <td class="name">{{$u.name}}</td>
-                                       <td class="email">{{$u.email}}</td>
-                                       <td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
-                                       <td class="tools">
-                                               <a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" title='{{$approve}}'><span class='icon like'></span></a>
-                                               <a href="{{$baseurl}}/regmod/deny/{{$u.hash}}" title='{{$deny}}'><span class='icon dislike'></span></a>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td class="pendingnote"><p><span>{{$pendingnotetext}}:</span> {{$u.note}}</p></td>
-                               </tr>
-                       {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>                        
-               {{else}}
-                       <p>{{$no_pending}}</p>
-               {{/if}}
-       
-               <h3>{{$h_users}}</h3>
-               {{if $users}}
-                       <table id='users'>
-                               <thead>
-                               <tr>
-                                       <th></th>
-                                       {{foreach $th_users as $th}}
-                                       <th>
-                                               <a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}">
-                                                       {{if $order_users == $th.1}}
-                                                               {{if $order_direction_users == "+"}}
-                                                               &#8595;
-                                                               {{else}}
-                                                               &#8593;
-                                                               {{/if}}
-                                                       {{else}}
-                                                               &#8597;
-                                                       {{/if}}
-                                               {{$th.0}}</a>
-                                       </th>
-                                       {{/foreach}}
-                                       <th></th>
-                                       <th></th>
-                               </tr>
-                               </thead>
-                               <tbody>
-                               {{foreach $users as $u}}
-                                       <tr>
-                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
-                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
-                                               <td class='email'>{{$u.email}}</td>
-                                               <td class='register_date'>{{$u.register_date}}</td>
-                                               <td class='login_date'>{{$u.login_date}}</td>
-                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
-                                               <td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
-                                               <td class="checkbox"> 
-                                               {{if $u.is_deletable}}
-                                                       <input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
-                                               {{else}}
-                                                       &nbsp;
-                                               {{/if}}
-                                               <td class="tools">
-                                               {{if $u.is_deletable}}
-                                                       <a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon {{if $u.blocked==0}}unlock{{else}}lock{{/if}}'></span></a>
-                                                       <a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon delete'></span></a>
-                                               {{else}}
-                                                       &nbsp;
-                                               {{/if}}
-                                               </td>
-                                       </tr>
-                               {{/foreach}}
-                               </tbody>
-                       </table>
-                       <div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
-                       <div class="submit"><input type="submit" name="page_users_block" value="{{$block}}/{{$unblock}}" /> <input type="submit" name="page_users_delete" value="{{$delete}}" onclick="return confirm_delete_multi()" /></div>                                          
-               {{else}}
-                       NO USERS?!?
-               {{/if}}
-       </form>
-       {{if $deleted}}
-               <h3>{{$h_deleted}}</h3>
-                       <table id='deleted'>
-                               <thead>
-                               <tr>
-                                       <th></th>
-                                       {{foreach $th_deleted as $th}}<th>{{$th}}</th>{{/foreach}}
-                               </tr>
-                               </thead>
-                               <tbody>
-                               {{foreach $deleted as $u}}
-                                       <tr>
-                                               <td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
-                                               <td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
-                                               <td class='email'>{{$u.email}}</td>
-                                               <td class='register_date'>{{$u.register_date}}</td>
-                                               <td class='login_date'>{{$u.login_date}}</td>
-                                               <td class='lastitem_date'>{{$u.lastitem_date}}</td>
-                                               <td class='login_date'>{{$u.deleted}}</td>
-                                       </tr>
-                               {{/foreach}}
-                               </tbody>
-                       </table>
-               {{/if}}
-  <h3>{{$h_newuser}}</h3> 
-  <form action="{{$baseurl}}/admin/users" method="post"> 
-  <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> 
-  <table id='users'> 
-      <tbody> 
-        <tr> 
-        <td>{{include file="field_input.tpl" field=$newusername}}</td> 
-    </tr> 
-        <tr> 
-        <td>{{include file="field_input.tpl" field=$newusernickname}}</td> 
-    </tr> 
-        <tr> 
-        <td>{{include file="field_input.tpl" field=$newuseremail}}</td> 
-    </tr> 
-      </tbody> 
-  </table> 
-  <div class="submit"><input type="submit" name="add_new_user_submit" value="{{$submit}}" /></div>             
-  </form>
-</div>
index 77e8d3895ee6803c46fd626daf6ef1b54dc6c9a5..1be216f87ba2ccb612edb1be9c0596e0207e2d92 100644 (file)
@@ -1,5 +1,7 @@
 /* Modifications by https://horche.demkontinuum.de/profile/hoergen */
 
+body { background-color: whitesmoke; }
+
 h1 {
   font-size: 18px;
   color: blue;
@@ -247,16 +249,26 @@ div.pager, ul.tabs {
 
 /* Post content */
 .wall-item-content blockquote {
-  border-left: 2px solid #D2D2D2;
+  border-left: 0px;
   margin-top: 10px;
   margin-bottom:10px;
   padding-left: 5px;
 }
 
+.wall-item-container .wall-item-content {
+  font-size: 14px;
+}
+
 .wall-item-content strong { color:#565656; }
 
 .wall-item-network { font-size:10px; }
 
+.contact-photo-wrapper .mframe .p-author .h-card {
+  width: 65px;
+}
+
+.shared-time { font-size: 10px; }
+
 .mention { font-size:12px;}
 
 .tag { font-size:12px; }
@@ -268,16 +280,31 @@ div.pager, ul.tabs {
   padding-top: 5px;
   padding-bottom: 5px;
   margin-top: 20px;
+  margin-bottom: 20px;
 }
 
 .type-link blockquote{
-  border-left: 2px solid #D2D2D2;
+  border-left: 0px;
   margin-top: 10px;
   margin-bottom:10px;
-  padding-left: 5px;
+  padding-left: 0px;
   font-size:12px;
 }
 
+.type-link .oembed, .type-video .oembed {
+  font-size: 14px;
+  font-weight: 300;
+  line-height: normal;
+}
+
+.shared_header {
+  min-height: 32px;;
+  color: #999;
+  border-top: 0px;
+  padding-top: 5px;
+  margin-top: 5px;
+}
+
 /* Post footer */
 .wall-item-like { font-size:12px; }
 
@@ -314,6 +341,10 @@ div.pager, ul.tabs {
 
 .wall-item-bottom { font-size: 14px; }
 
+.icon::before {
+  width: 10px;
+}
+
 /* comments */
 
 .wall-item-like { font-size:10px; }
@@ -421,5 +452,57 @@ select {
 }
 
 .field label {
-   width: 300px;
+  width: 300px;
 }
+
+/* popup */
+
+ul.menu-popup {
+  width: 16em;
+}
+
+ul.menu-popup a {
+  padding: 0 0 0 5px;
+}
+
+/* Growl Popup */
+
+.jGrowl, .notice * {
+  color: white;
+}
+
+/* Buttons */
+
+input[type=submit] {
+  padding:0px 20px; 
+  color:white;
+  background:#6c82ff; 
+  border:1px solid darkgrey;
+  cursor:pointer;
+  -webkit-border-radius: 5px;
+  border-radius: 5px; 
+  -webkit-transition-duration: 0.4s; /* Safari */
+  transition-duration: 0.4s;
+  box-shadow: 2px 2px 15px 0 rgba(0,0,0,0.24);
+}
+
+input[type=submit]:hover {
+  background:#0026ff; 
+
+}
+
+input[type=text], input[type=password], input[type=email], input[type=url] {
+  padding:2px 2px; 
+  background:white; 
+  border:1px solid darkgrey;
+  cursor:pointer;
+  -webkit-border-radius: 5px;
+  border-radius: 5px; 
+  -webkit-transition-duration: 0.4s; /* Safari */
+  transition-duration: 0.4s;
+}
+
+input[type=text]:focus, input[type=password]:focus, input[type=email]:focus, input[type=url]:focus {
+  background-color:#eef3ff;
+}
+
index a8654f743b1a0a2dce32aa46926dfe1b1c34d7fd..0f81200890be8b702c22761669b2a08b731f93ac 100644 (file)
@@ -110,13 +110,13 @@ EOT;
 function get_vier_config($key, $default = false, $admin = false) {
        if (local_user() && !$admin) {
                $result = PConfig::get(local_user(), "vier", $key);
-               if ($result !== false) {
+               if (!is_null($result)) {
                        return $result;
                }
        }
 
        $result = Config::get("vier", $key);
-       if ($result !== false) {
+       if (!is_null($result)) {
                return $result;
        }