Merge remote-tracking branch 'upstream/develop' into dfrn-rework

This commit is contained in:
Michael 2018-04-22 07:45:28 +00:00
commit c118c03a70
35 changed files with 24547 additions and 23731 deletions

View file

@ -25,6 +25,7 @@
"paragonie/random_compat": "^2.0", "paragonie/random_compat": "^2.0",
"pear/Text_LanguageDetect": "1.*", "pear/Text_LanguageDetect": "1.*",
"pear/Text_Highlighter": "dev-master", "pear/Text_Highlighter": "dev-master",
"seld/cli-prompt": "^1.0",
"smarty/smarty": "^3.1", "smarty/smarty": "^3.1",
"fxp/composer-asset-plugin": "~1.3", "fxp/composer-asset-plugin": "~1.3",
"bower-asset/base64": "^1.0", "bower-asset/base64": "^1.0",

50
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "96062c2020a40f14b52e5e91c79995a7", "content-hash": "f97245142e60a521f048a667bec4e436",
"packages": [ "packages": [
{ {
"name": "asika/simple-console", "name": "asika/simple-console",
@ -1988,6 +1988,54 @@
"description": "PSR-6 adapter for RW File Cache", "description": "PSR-6 adapter for RW File Cache",
"time": "2018-01-30T19:13:45+00:00" "time": "2018-01-30T19:13:45+00:00"
}, },
{
"name": "seld/cli-prompt",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/cli-prompt.git",
"reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
"reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Seld\\CliPrompt\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be"
}
],
"description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type",
"keywords": [
"cli",
"console",
"hidden",
"input",
"prompt"
],
"time": "2017-03-18T11:32:45+00:00"
},
{ {
"name": "smarty/smarty", "name": "smarty/smarty",
"version": "v3.1.31", "version": "v3.1.31",

View file

@ -21,6 +21,18 @@ $db_user = 'mysqlusername';
$db_pass = 'mysqlpassword'; $db_pass = 'mysqlpassword';
$db_data = 'mysqldatabasename'; $db_data = 'mysqldatabasename';
// Use environment variables for mysql if they are set beforehand
if (!empty(getenv('MYSQL_HOST'))
&& !empty(getenv('MYSQL_PORT'))
&& !empty(getenv('MYSQL_USERNAME'))
&& !empty(getenv('MYSQL_PASSWORD'))
&& !empty(getenv('MYSQL_DATABASE'))) {
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
$db_user = getenv('MYSQL_USERNAME');
$db_pass = getenv('MYSQL_PASSWORD');
$db_data = getenv('MYSQL_DATABASE');
}
// Set the database connection charset to full Unicode (utf8mb4). // Set the database connection charset to full Unicode (utf8mb4).
// Changing this value will likely corrupt the special characters. // Changing this value will likely corrupt the special characters.
// You have been warned. // You have been warned.

View file

@ -863,7 +863,7 @@ class dba {
* *
* @return boolean|array was the delete successful? When $in_process is set: deletion data * @return boolean|array was the delete successful? When $in_process is set: deletion data
*/ */
public static function delete($table, array $conditions, $in_process = false, array &$callstack = []) public static function delete($table, array $conditions, array $options = [], $in_process = false, array &$callstack = [])
{ {
if (empty($table) || empty($conditions)) { if (empty($table) || empty($conditions)) {
logger('Table and conditions have to be set'); logger('Table and conditions have to be set');
@ -886,8 +886,10 @@ class dba {
$commands[$key] = ['table' => $table, 'conditions' => $conditions]; $commands[$key] = ['table' => $table, 'conditions' => $conditions];
$cascade = defaults($options, 'cascade', true);
// To speed up the whole process we cache the table relations // To speed up the whole process we cache the table relations
if (count(self::$relation) == 0) { if ($cascade && count(self::$relation) == 0) {
self::buildRelationData(); self::buildRelationData();
} }
@ -905,7 +907,7 @@ class dba {
if ((count($conditions) == 1) && ($field == array_keys($conditions)[0])) { if ((count($conditions) == 1) && ($field == array_keys($conditions)[0])) {
foreach ($rel_def AS $rel_table => $rel_fields) { foreach ($rel_def AS $rel_table => $rel_fields) {
foreach ($rel_fields AS $rel_field) { foreach ($rel_fields AS $rel_field) {
$retval = self::delete($rel_table, [$rel_field => array_values($conditions)[0]], true, $callstack); $retval = self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, true, $callstack);
$commands = array_merge($commands, $retval); $commands = array_merge($commands, $retval);
} }
} }
@ -919,7 +921,7 @@ class dba {
while ($row = self::fetch($data)) { while ($row = self::fetch($data)) {
// Now we accumulate the delete commands // Now we accumulate the delete commands
$retval = self::delete($table, [$field => $row[$field]], true, $callstack); $retval = self::delete($table, [$field => $row[$field]], $options, true, $callstack);
$commands = array_merge($commands, $retval); $commands = array_merge($commands, $retval);
} }

View file

@ -1735,13 +1735,28 @@ function admin_page_users(App $a)
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email'])); $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
$_setup_users = function ($e) use ($adminlist) { $_setup_users = function ($e) use ($adminlist) {
$accounts = [ $page_types = [
L10n::t('Normal Account'), PAGE_NORMAL => L10n::t('Normal Account Page'),
L10n::t('Automatic Follower Account'), PAGE_SOAPBOX => L10n::t('Soapbox Page'),
L10n::t('Public Forum Account'), PAGE_COMMUNITY => L10n::t('Public Forum'),
L10n::t('Automatic Friend Account') PAGE_FREELOVE => L10n::t('Automatic Friend Page'),
PAGE_PRVGROUP => L10n::t('Private Forum')
]; ];
$e['page-flags'] = $accounts[$e['page-flags']]; $account_types = [
ACCOUNT_TYPE_PERSON => L10n::t('Personal Page'),
ACCOUNT_TYPE_ORGANISATION => L10n::t('Organisation Page'),
ACCOUNT_TYPE_NEWS => L10n::t('News Page'),
ACCOUNT_TYPE_COMMUNITY => L10n::t('Community Forum')
];
$e['page-flags-raw'] = $e['page-flags'];
$e['page-flags'] = $page_types[$e['page-flags']];
$e['account-type-raw'] = ($e['page_flags_raw']==0) ? $e['account-type'] : -1;
$e['account-type'] = ($e['page_flags_raw']==0) ? $account_types[$e['account-type']] : "";
$e['register_date'] = Temporal::getRelativeDate($e['register_date']); $e['register_date'] = Temporal::getRelativeDate($e['register_date']);
$e['login_date'] = Temporal::getRelativeDate($e['login_date']); $e['login_date'] = Temporal::getRelativeDate($e['login_date']);
$e['lastitem_date'] = Temporal::getRelativeDate($e['lastitem_date']); $e['lastitem_date'] = Temporal::getRelativeDate($e['lastitem_date']);
@ -1778,8 +1793,7 @@ function admin_page_users(App $a)
array_push($users, array_pop($tmp_users)); array_push($users, array_pop($tmp_users));
} }
$th_users = array_map(null, [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Account')], $valid_orders $th_users = array_map(null, [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Type')], $valid_orders);
);
$t = get_markup_template('admin/users.tpl'); $t = get_markup_template('admin/users.tpl');
$o = replace_macros($t, [ $o = replace_macros($t, [

View file

@ -23,9 +23,18 @@ function noscrape_init(App $a)
Profile::load($a, $which, $profile); Profile::load($a, $which, $profile);
$json_info = [
'addr' => $a->profile['addr'],
'nick' => $which,
'guid' => $a->profile['guid'],
'key' => $a->profile['pubkey'],
'homepage' => System::baseUrl()."/profile/{$which}",
'comm' => ($a->profile['account-type'] == ACCOUNT_TYPE_COMMUNITY),
];
if (!$a->profile['net-publish'] || $a->profile['hidewall']) { if (!$a->profile['net-publish'] || $a->profile['hidewall']) {
header('Content-type: application/json; charset=utf-8'); header('Content-type: application/json; charset=utf-8');
$json_info = ["hide" => true]; $json_info["hide"] = true;
echo json_encode($json_info); echo json_encode($json_info);
exit; exit;
} }
@ -36,17 +45,9 @@ function noscrape_init(App $a)
$contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]); $contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
$json_info = [ $json_info['fn'] = $a->profile['name'];
'fn' => $a->profile['name'], $json_info['photo'] = $contactPhoto["photo"];
'addr' => $a->profile['addr'], $json_info['tags'] = $keywords;
'nick' => $which,
'guid' => $a->profile['guid'],
'key' => $a->profile['pubkey'],
'homepage' => System::baseUrl()."/profile/{$which}",
'comm' => (x($a->profile, 'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY),
'photo' => $contactPhoto["photo"],
'tags' => $keywords
];
if (is_array($a->profile) && !$a->profile['hide-friends']) { if (is_array($a->profile) && !$a->profile['hide-friends']) {
/// @todo What should this value tell us? /// @todo What should this value tell us?

View file

@ -180,16 +180,12 @@ class Nav
$nav['home'] = ['profile/' . $a->user['nickname'], L10n::t('Home'), '', L10n::t('Your posts and conversations')]; $nav['home'] = ['profile/' . $a->user['nickname'], L10n::t('Home'), '', L10n::t('Your posts and conversations')];
if (in_array($_SESSION['page_flags'], [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_PRVGROUP])) { // Don't show notifications for public communities
// only show friend requests for normal pages. Other page types have automatic friendship. if ($_SESSION['page_flags'] != PAGE_COMMUNITY) {
if (in_array($_SESSION['page_flags'], [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_PRVGROUP])) { $nav['introductions'] = ['notifications/intros', L10n::t('Introductions'), '', L10n::t('Friend Requests')];
$nav['introductions'] = ['notifications/intros', L10n::t('Introductions'), '', L10n::t('Friend Requests')]; $nav['notifications'] = ['notifications', L10n::t('Notifications'), '', L10n::t('Notifications')];
} $nav['notifications']['all'] = ['notifications/system', L10n::t('See all notifications'), '', ''];
if (in_array($_SESSION['page_flags'], [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE])) { $nav['notifications']['mark'] = ['', L10n::t('Mark as seen'), '', L10n::t('Mark all system notifications seen')];
$nav['notifications'] = ['notifications', L10n::t('Notifications'), '', L10n::t('Notifications')];
$nav['notifications']['all'] = ['notifications/system', L10n::t('See all notifications'), '', ''];
$nav['notifications']['mark'] = ['', L10n::t('Mark as seen'), '', L10n::t('Mark all system notifications seen')];
}
} }
$nav['messages'] = ['message', L10n::t('Messages'), '', L10n::t('Private mail')]; $nav['messages'] = ['message', L10n::t('Messages'), '', L10n::t('Private mail')];

View file

@ -246,7 +246,7 @@ class Addon
} else { } else {
// remove orphan hooks // remove orphan hooks
$condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]]; $condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]];
dba::delete('hook', $condition); dba::delete('hook', $condition, ['cascade' => false]);
} }
} }

View file

@ -27,7 +27,7 @@ class NewPassword extends \Asika\SimpleConsole\Console
$help = <<<HELP $help = <<<HELP
console newpassword - Creates a new password for a given user console newpassword - Creates a new password for a given user
Usage Usage
bin/console newpassword <nickname> <password> [-h|--help|-?] [-v] bin/console newpassword <nickname> [<password>] [-h|--help|-?] [-v]
Description Description
Creates a new password for a user without using the "forgot password" functionality. Creates a new password for a user without using the "forgot password" functionality.
@ -67,13 +67,22 @@ HELP;
} }
$nick = $this->getArgument(0); $nick = $this->getArgument(0);
$password = $this->getArgument(1);
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]); $user = dba::selectFirst('user', ['uid'], ['nickname' => $nick]);
if (!DBM::is_result($user)) { if (!DBM::is_result($user)) {
throw new \RuntimeException(L10n::t('User not found')); throw new \RuntimeException(L10n::t('User not found'));
} }
$password = $this->getArgument(1);
if (is_null($password)) {
$this->out(L10n::t('Enter new password: '), false);
$password = \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
}
if (!$password) {
throw new \RuntimeException(L10n::t('Password can\'t be empty'));
}
if (!Config::get('system', 'disable_password_exposed', false) && User::isPasswordExposed($password)) { if (!Config::get('system', 'disable_password_exposed', false) && User::isPasswordExposed($password)) {
throw new \RuntimeException(L10n::t('The new password has been exposed in a public data dump, please choose another.')); throw new \RuntimeException(L10n::t('The new password has been exposed in a public data dump, please choose another.'));
} }

View file

@ -423,7 +423,7 @@ class Contact extends BaseObject
// Fetch the data from the gcontact table // Fetch the data from the gcontact table
if (!DBM::is_result($r)) { if (!DBM::is_result($r)) {
$s = dba::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`, $s = dba::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self` `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, 0 AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
FROM `gcontact` WHERE `nurl` = ?", normalise_link($url)); FROM `gcontact` WHERE `nurl` = ?", normalise_link($url));
$r = dba::inArray($s); $r = dba::inArray($s);
} }

View file

@ -258,6 +258,10 @@ class User
*/ */
public static function hashPassword($password) public static function hashPassword($password)
{ {
if (!trim($password)) {
throw new Exception(L10n::t('Password can\'t be empty'));
}
return password_hash($password, PASSWORD_DEFAULT); return password_hash($password, PASSWORD_DEFAULT);
} }

View file

@ -1467,33 +1467,33 @@ class DFRN
// Check for duplicates // Check for duplicates
$r = q( $r = q(
"SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1", "SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1",
intval($contact["uid"]), intval($contact['uid']),
intval($contact["id"]), intval($contact['id']),
dbesc(DateTimeFormat::utc($birthday)), dbesc(DateTimeFormat::utc($birthday)),
dbesc("birthday") dbesc('birthday')
); );
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
return; return;
} }
logger("updating birthday: ".$birthday." for contact ".$contact["id"]); logger('updating birthday: ' . $birthday . ' for contact ' . $contact['id']);
$bdtext = L10n::t("%s\'s birthday", $contact["name"]); $bdtext = L10n::t('%s\'s birthday', $contact['name']);
$bdtext2 = L10n::t("Happy Birthday %s", " [url=".$contact["url"]."]".$contact["name"]."[/url]"); $bdtext2 = L10n::t('Happy Birthday %s', ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]');
$r = q( $r = q(
"INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`) "INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`)
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
intval($contact["uid"]), intval($contact['uid']),
intval($contact["id"]), intval($contact['id']),
dbesc(DateTimeFormat::utcNow()), dbesc(DateTimeFormat::utcNow()),
dbesc(DateTimeFormat::utcNow()), dbesc(DateTimeFormat::utcNow()),
dbesc(DateTimeFormat::utc($birthday)), dbesc(DateTimeFormat::utc($birthday)),
dbesc(DateTimeFormat::utc($birthday . " + 1 day ")), dbesc(DateTimeFormat::utc($birthday . ' + 1 day ')),
dbesc($bdtext), dbesc($bdtext),
dbesc($bdtext2), dbesc($bdtext2),
dbesc("birthday") dbesc('birthday')
); );
} }
@ -2923,6 +2923,9 @@ class DFRN
logger("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG); logger("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
// is it a public forum? Private forums aren't exposed with this method
$forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()")->item(0)->nodeValue);
// The account type is new since 3.5.1 // The account type is new since 3.5.1
if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) { if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) {
$accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()")->item(0)->nodeValue); $accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()")->item(0)->nodeValue);
@ -2930,17 +2933,17 @@ class DFRN
if ($accounttype != $importer["contact-type"]) { if ($accounttype != $importer["contact-type"]) {
dba::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]); dba::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]);
} }
} // A forum contact can either have set "forum" or "prv" - but not both
if (($accounttype == ACCOUNT_TYPE_COMMUNITY) && (($forum != $importer["forum"]) || ($forum == $importer["prv"]))) {
// is it a public forum? Private forums aren't supported with this method $condition = ['(`forum` != ? OR `prv` != ?) AND `id` = ?', $forum, !$forum, $importer["id"]];
// This is deprecated since 3.5.1 dba::update('contact', ['forum' => $forum, 'prv' => !$forum], $condition);
$forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()")->item(0)->nodeValue); }
} elseif ($forum != $importer["forum"]) { // Deprecated since 3.5.1
if ($forum != $importer["forum"]) {
$condition = ['`forum` != ? AND `id` = ?', $forum, $importer["id"]]; $condition = ['`forum` != ? AND `id` = ?', $forum, $importer["id"]];
dba::update('contact', ['forum' => $forum], $condition); dba::update('contact', ['forum' => $forum], $condition);
} }
// We are processing relocations even if we are ignoring a contact // We are processing relocations even if we are ignoring a contact
$relocations = $xpath->query("/atom:feed/dfrn:relocate"); $relocations = $xpath->query("/atom:feed/dfrn:relocate");
foreach ($relocations as $relocation) { foreach ($relocations as $relocation) {

View file

@ -1173,7 +1173,7 @@ class Diaspora
// Yes, then it is fine. // Yes, then it is fine.
return true; return true;
// Is it a post to a community? // Is it a post to a community?
} elseif (($contact["rel"] == CONTACT_IS_FOLLOWER) && ($importer["page-flags"] == PAGE_COMMUNITY)) { } elseif (($contact["rel"] == CONTACT_IS_FOLLOWER) && in_array($importer["page-flags"], [PAGE_COMMUNITY, PAGE_PRVGROUP])) {
// That's good // That's good
return true; return true;
// Is the message a global user or a comment? // Is the message a global user or a comment?
@ -2665,7 +2665,7 @@ class Diaspora
Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true); Contact::updateAvatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
if ($importer["page-flags"] == PAGE_NORMAL) { if (in_array($importer["page-flags"], [PAGE_NORMAL, PAGE_PRVGROUP])) {
logger("Sending intra message for author ".$author.".", LOGGER_DEBUG); logger("Sending intra message for author ".$author.".", LOGGER_DEBUG);
$hash = random_string().(string)time(); // Generate a confirm_key $hash = random_string().(string)time(); // Generate a confirm_key

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,18 @@ $db_user = '{{$dbuser}}';
$db_pass = '{{$dbpass}}'; $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}'; $db_data = '{{$dbdata}}';
// Use environment variables for mysql if they are set beforehand
if (!empty(getenv('MYSQL_HOST'))
&& !empty(getenv('MYSQL_PORT'))
&& !empty(getenv('MYSQL_USERNAME'))
&& !empty(getenv('MYSQL_PASSWORD'))
&& !empty(getenv('MYSQL_DATABASE'))) {
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
$db_user = getenv('MYSQL_USERNAME');
$db_pass = getenv('MYSQL_PASSWORD');
$db_data = getenv('MYSQL_DATABASE');
}
// Set the database connection charset to full Unicode (utf8mb4). // Set the database connection charset to full Unicode (utf8mb4).
// Changing this value will likely corrupt the special characters. // Changing this value will likely corrupt the special characters.
// You have been warned. // You have been warned.

View file

@ -1,7 +1,16 @@
#admin-users.adminpage { padding-left:0; padding-right: 0;} #admin-users.adminpage { padding-left:0; padding-right: 0;}
#admin-users.adminpage > h1 { padding: 0 15px; } #admin-users.adminpage > h1 { padding: 0 15px; }
#users img.icon, #deleted img.icon { height: 24px; }
#admin-users td { word-break: break-all; }
#admin-users #users th:first-of-type { width: 1em; }
#admin-users #users th:nth-of-type(2) { width: 40px; }
#admin-users #users th:last-of-type { width: 1em; }
#admin-users #deleted th:first-of-type { width: 40px; }
#admin-users #users img.avatar-nano, #deleted img.avatar-nano { height: 24px; width: 24px; }
.opened .caret { transform: rotate(180deg); } .opened .caret { transform: rotate(180deg); }
tr.details td, tr.details td,
tr.details th tr.details th

View file

@ -2115,7 +2115,8 @@ ul.dropdown-menu li:hover {
.allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper, .allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper,
.directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper, .directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper,
.message-content-wrapper, .apps-content-wrapper, .photos-content-wrapper, .message-content-wrapper, .apps-content-wrapper, .photos-content-wrapper,
#adminpage, .viewcontacts-content-wrapper, .dfrn_request-content-wrapper, #adminpage, .delegate-content-wrapper, .uexport-content-wrapper,
.viewcontacts-content-wrapper, .dfrn_request-content-wrapper,
.friendica-content-wrapper, .credits-content-wrapper, .nogroup-content-wrapper, .friendica-content-wrapper, .credits-content-wrapper, .nogroup-content-wrapper,
.profperm-content-wrapper { .profperm-content-wrapper {
min-height: calc(100vh - 150px); min-height: calc(100vh - 150px);
@ -2409,10 +2410,13 @@ ul li:hover .contact-wrapper .contact-action-link:hover {
height: 48px; height: 48px;
width: 48px; width: 48px;
} }
#prvmail-end { #prvmail-end {
clear:both; clear:both;
} }
#modal #prvmail-text-edit-bb .bb-img {
display: none;
}
/* photos */ /* photos */
.photo-album-actions { .photo-album-actions {
margin-bottom: 10px; margin-bottom: 10px;

View file

@ -231,7 +231,6 @@ var FileBrowser = {
$(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active"); $(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active");
// We need to add the AjaxUpload to the button // We need to add the AjaxUpload to the button
FileBrowser.uploadButtons(); FileBrowser.uploadButtons();
}, },
// Load new content (e.g. change photo album) // Load new content (e.g. change photo album)

View file

@ -152,6 +152,7 @@ Dialog._load = function(url) {
var jsbrowser = function() { var jsbrowser = function() {
FileBrowser.init(nickname, type, hash); FileBrowser.init(nickname, type, hash);
}; };
loadScript("view/js/ajaxupload.js");
loadScript("view/theme/frio/js/filebrowser.js", jsbrowser); loadScript("view/theme/frio/js/filebrowser.js", jsbrowser);
}; };

View file

@ -446,8 +446,16 @@ function justifyPhotosAjax() {
$('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; }); $('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; });
} }
// Load a js script to the html head.
function loadScript(url, callback) { function loadScript(url, callback) {
// Adding the script tag to the head as suggested before // Check if the script is already in the html head.
var oscript = $('head script[src="' + url + '"]');
// Delete the old script from head.
if (oscript.length > 0) {
oscript.remove();
}
// Adding the script tag to the head as suggested before.
var head = document.getElementsByTagName('head')[0]; var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script'); var script = document.createElement('script');
script.type = 'text/javascript'; script.type = 'text/javascript';
@ -458,7 +466,7 @@ function loadScript(url, callback) {
script.onreadystatechange = callback; script.onreadystatechange = callback;
script.onload = callback; script.onload = callback;
// Fire the loading // Fire the loading.
head.appendChild(script); head.appendChild(script);
} }

View file

@ -26,40 +26,43 @@ if (!isset($minimal)) {
<script type="text/javascript">var baseurl = "<?php echo System::baseUrl(); ?>";</script> <script type="text/javascript">var baseurl = "<?php echo System::baseUrl(); ?>";</script>
<script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script> <script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script>
<?php <?php
$baseurl = System::baseUrl(); $basepath = $a->path ? "/" . $a->path . "/" : "/";
$frio = "view/theme/frio"; $frio = "view/theme/frio";
// Because we use minimal for modals the header and the included js stuff should be only loaded
// if the page is an standard page (so we don't have it twice for modals)
//
/// @todo Think about to move js stuff in the footer
if (!$minimal && x($page, 'htmlhead')) {
echo $page['htmlhead'];
}
// Add the theme color meta
// It makes mobile Chrome UI match Frio's top bar color.
$uid = $a->profile_uid;
if (is_null($uid)) {
$uid = Profile::getThemeUid();
}
$schema = PConfig::get($uid, 'frio', 'schema');
if (($schema) && ($schema != '---')) {
if (file_exists('view/theme/frio/schema/' . $schema . '.php')) {
$schemefile = 'view/theme/frio/schema/' . $schema . '.php';
require_once $schemefile;
}
} else {
$nav_bg = PConfig::get($uid, 'frio', 'nav_bg');
}
if (!$nav_bg) {
$nav_bg = "#708fa0";
}
echo '
<meta name="theme-color" content="' . $nav_bg . '" />';
$is_singleuser = Config::get('system','singleuser'); // Because we use minimal for modals the header and the included js stuff should be only loaded
$is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser"; // if the page is an standard page (so we don't have it twice for modals)
//
/// @todo Think about to move js stuff in the footer
if (!$minimal && x($page, 'htmlhead')) {
echo $page['htmlhead'];
}
// Add the theme color meta
// It makes mobile Chrome UI match Frio's top bar color.
$uid = $a->profile_uid;
if (is_null($uid)) {
$uid = Profile::getThemeUid();
}
$schema = PConfig::get($uid, 'frio', 'schema');
if (($schema) && ($schema != '---')) {
if (file_exists('view/theme/frio/schema/' . $schema . '.php')) {
$schemefile = 'view/theme/frio/schema/' . $schema . '.php';
require_once $schemefile;
}
} else {
$nav_bg = PConfig::get($uid, 'frio', 'nav_bg');
}
if (!$nav_bg) {
$nav_bg = "#708fa0";
}
echo '
<meta name="theme-color" content="' . $nav_bg . '" />';
$is_singleuser = Config::get('system','singleuser');
$is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
?> ?>
</head> </head>
<body id="top" class="mod-<?php echo $a->module." ".$is_singleuser_class;?>"> <body id="top" class="mod-<?php echo $a->module." ".$is_singleuser_class;?>">
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a> <a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
<?php <?php
@ -90,8 +93,8 @@ if (!isset($minimal)) {
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<?php <?php
if ((!x($_REQUEST, 'pagename') || $_REQUEST['pagename'] != "lostpass") && ($_SERVER['REQUEST_URI'] != "/")) { if ((!x($_REQUEST, 'pagename') || $_REQUEST['pagename'] != "lostpass") && ($_SERVER['REQUEST_URI'] != $basepath)) {
echo ' echo '
<aside class="col-lg-3 col-md-3 offcanvas-sm offcanvas-xs">'; <aside class="col-lg-3 col-md-3 offcanvas-sm offcanvas-xs">';
if (x($page, 'aside')) { if (x($page, 'aside')) {
@ -107,18 +110,18 @@ if (!isset($minimal)) {
<div class="col-lg-7 col-md-7 col-sm-12 col-xs-12" id="content"> <div class="col-lg-7 col-md-7 col-sm-12 col-xs-12" id="content">
<section class="sectiontop '; <section class="sectiontop ';
echo $a->argv[0]; echo $a->argv[0];
echo '-content-wrapper">'; echo '-content-wrapper">';
if (x($page, 'content')) { if (x($page, 'content')) {
echo $page['content']; echo $page['content'];
} }
echo ' echo '
<div id="pause"></div> <!-- The pause/resume Ajax indicator --> <div id="pause"></div> <!-- The pause/resume Ajax indicator -->
</section> </section>
</div> </div>
'; ';
} else { } else {
echo ' echo '
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="content" style="margin-top:50px;">'; <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="content" style="margin-top:50px;">';
if (x($page, 'content')) { if (x($page, 'content')) {
echo $page['content']; echo $page['content'];
@ -126,7 +129,7 @@ if (!isset($minimal)) {
echo ' echo '
</div> </div>
'; ';
} }
?> ?>
</div><!--row--> </div><!--row-->
</div><!-- container --> </div><!-- container -->

View file

@ -55,7 +55,7 @@
<button type="button" class="btn btn-default selectnone" data-select-none="pending_ckbx"><i class="fa fa-square-o" aria-hidden="true"></i></button> <button type="button" class="btn btn-default selectnone" data-select-none="pending_ckbx"><i class="fa fa-square-o" aria-hidden="true"></i></button>
</div> </div>
</div> </div>
<div class="col-xs-9"> <div class="col-xs-9 text-right">
<button type="submit" name="page_users_deny" class="btn btn-primary"><i class="fa fa-thumbs-down" aria-hidden="true"></i> {{$deny}}</button> <button type="submit" name="page_users_deny" class="btn btn-primary"><i class="fa fa-thumbs-down" aria-hidden="true"></i> {{$deny}}</button>
<button type="submit" name="page_users_approve" class="btn btn-warinig"><i class="fa fa-thumbs-up" aria-hidden="true"></i> {{$approve}}</button> <button type="submit" name="page_users_approve" class="btn btn-warinig"><i class="fa fa-thumbs-up" aria-hidden="true"></i> {{$approve}}</button>
</div> </div>
@ -84,7 +84,7 @@
<th></th> <th></th>
{{foreach $th_users as $k=>$th}} {{foreach $th_users as $k=>$th}}
{{if $k < 2 || $order_users == $th.1 || ($k==5 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1])) }} {{if $k < 2 || $order_users == $th.1 || ($k==5 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1])) }}
<th> <th class="th-{{$k}}">
<a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}"> <a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th.1}}">
{{if $order_users == $th.1}} {{if $order_users == $th.1}}
{{if $order_direction_users == "+"}} {{if $order_direction_users == "+"}}
@ -112,7 +112,7 @@
&nbsp; &nbsp;
{{/if}} {{/if}}
</td> </td>
<td><img class="icon" src="{{$u.micro}}" title="{{$u.nickname}}"></td> <td><img class="avatar-nano" src="{{$u.micro}}" title="{{$u.nickname}}"></td>
<td><a href="{{$u.url}}" title="{{$u.nickname}}"> {{$u.name}}</a></td> <td><a href="{{$u.url}}" title="{{$u.nickname}}"> {{$u.name}}</a></td>
<td>{{$u.email}}</td> <td>{{$u.email}}</td>
{{if $order_users == $th_users.2.1}} {{if $order_users == $th_users.2.1}}
@ -128,7 +128,26 @@
{{/if}} {{/if}}
{{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1]) }} {{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1]) }}
<td>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
<td>
<i class="fa
{{if $u.page_flags_raw==0}}fa-user{{/if}} {{* PAGE_NORMAL *}}
{{if $u.page_flags_raw==1}}fa-bullhorn{{/if}} {{* PAGE_SOAPBOX *}}
{{if $u.page_flags_raw==2}}fa-users{{/if}} {{* PAGE_COMMUNITY *}}
{{if $u.page_flags_raw==3}}fa-heart{{/if}} {{* PAGE_FREELOVE *}}
{{if $u.page_flags_raw==4}}fa-rss{{/if}} {{* PAGE_BLOG *}}
{{if $u.page_flags_raw==5}}fa-user-secret{{/if}} {{* PAGE_PRVGROUP *}}
" title="{{$u.page_flags}}"></i>
{{if $u.page_flags_raw==0 && $u.account_type_raw > 0}}
<i class="fa
{{if $u.account_type_raw==1}}fa-sitemap{{/if}} {{* ACCOUNT_TYPE_ORGANISATION *}}
{{if $u.account_type_raw==2}}fa-newspaper-o{{/if}} {{* ACCOUNT_TYPE_NEWS *}}
{{if $u.account_type_raw==3}}fa-comments{{/if}} {{* ACCOUNT_TYPE_COMMUNITY *}}
" title="{{$u.account_type}}"></i>
{{/if}}
{{if $u.is_admin}}<i class="fa fa-user-md text-primary" title="{{$siteadmin}}"></i>{{/if}}
{{if $u.account_expired}}<i class="fa fa-clock-o text-warning" title="{{$accountexpired}}"></i>{{/if}}
</td>
{{/if}} {{/if}}
<td class="text-right"> <td class="text-right">
<button type="button" class="btn-link" onclick="return details({{$u.uid}})"><span class="caret"></span></button> <button type="button" class="btn-link" onclick="return details({{$u.uid}})"><span class="caret"></span></button>
@ -154,7 +173,7 @@
{{if in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1]) }} {{if in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1]) }}
<p><a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th_users.5.1}}"> <p><a href="{{$baseurl}}/admin/users/?o={{if $order_direction_users == "+"}}-{{/if}}{{$th_users.5.1}}">
&#8597; {{$th_users.5.0}}</a> : {{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</p> &#8597; {{$th_users.5.0}}</a> : {{$u.page_flags}}{{if $u.page_flags_raw==0 && $u.account_type_raw > 0}}, {{$u.account_type}}{{/if}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</p>
{{/if}} {{/if}}
</td> </td>
@ -227,7 +246,7 @@
<tbody> <tbody>
{{foreach $deleted as $u}} {{foreach $deleted as $u}}
<tr> <tr>
<td><img class="icon" src="{{$u.micro}}" title="{{$u.nickname}}"></td> <td><img class="avatar-nano" src="{{$u.micro}}" title="{{$u.nickname}}"></td>
<td><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td> <td><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
<td>{{$u.email}}</td> <td>{{$u.email}}</td>
<td>{{$u.deleted}}</td> <td>{{$u.deleted}}</td>

View file

@ -33,7 +33,7 @@
{{/if}} {{/if}}
<ul class="comment-edit-bb-{{$id}} comment-icon-list nav nav-pills pull-right"> <ul class="comment-edit-bb-{{$id}} comment-icon-list nav nav-pills pull-right">
<li> <li>
<button type="button" class="btn-link icon" style="cursor: pointer;" aria-label="{{$edimg}}" title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}"> <button type="button" class="btn-link icon bb-img" style="cursor: pointer;" aria-label="{{$edimg}}" title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}">
<i class="fa fa-picture-o"></i> <i class="fa fa-picture-o"></i>
</button> </button>
</li> </li>

View file

@ -79,7 +79,7 @@
<ul id="event-desc-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left"> <ul id="event-desc-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
{{* commented out because it isn't implemented yet {{* commented out because it isn't implemented yet
<li> <li>
<button type="button" class="btn-link icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="desc"> <button type="button" class="btn-link icon bb-img" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="desc">
<i class="fa fa-picture-o"></i> <i class="fa fa-picture-o"></i>
</button> </button>
</li> </li>
@ -126,7 +126,7 @@
<ul id="comment-tools-loc" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left"> <ul id="comment-tools-loc" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
{{* commented out because it isn't implemented yet {{* commented out because it isn't implemented yet
<li> <li>
<button type="button" class="btn-link icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="loc"> <button type="button" class="btn-link icon bb-img" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="loc">
<i class="fa fa-picture-o"></i> <i class="fa fa-picture-o"></i>
</button> </button>
</li> </li>

View file

@ -33,7 +33,7 @@
<ul id="prvmail-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left"> <ul id="prvmail-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
<li> <li>
<button type="button" class="btn-link icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="input"> <button type="button" class="btn-link icon bb-img" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="input">
<i class="fa fa-picture-o" aria-hidden="true"></i> <i class="fa fa-picture-o" aria-hidden="true"></i>
</button> </button>
</li> </li>