Merge pull request #1 from friendica/develop

Develop
This commit is contained in:
gerhard6380 2015-11-24 02:58:08 +01:00
commit e16360f6d2
44 changed files with 9490 additions and 8303 deletions

View File

@ -19,7 +19,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Lily of the valley'); define ( 'FRIENDICA_CODENAME', 'Lily of the valley');
define ( 'FRIENDICA_VERSION', '3.4.3-dev' ); define ( 'FRIENDICA_VERSION', '3.4.3-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1190 ); define ( 'DB_UPDATE_VERSION', 1191 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -30,6 +30,7 @@ Friendica Documentation and Resources
* [Install](help/Install) * [Install](help/Install)
* [Settings](help/Settings) * [Settings](help/Settings)
* [Installing Connectors (Twitter/GNU Social)](help/Installing-Connectors) * [Installing Connectors (Twitter/GNU Social)](help/Installing-Connectors)
* [Install an ejabberd server (XMPP chat) with synchronized credentials](help/install-ejabberd)
* [Message Flow](help/Message-Flow) * [Message Flow](help/Message-Flow)
* [Using SSL with Friendica](help/SSL) * [Using SSL with Friendica](help/SSL)
* [Twitter/GNU Social API Functions](help/api) * [Twitter/GNU Social API Functions](help/api)

View File

@ -32,6 +32,7 @@ Friendica - Dokumentation und Ressourcen
* [Konfigurationen](help/Settings) * [Konfigurationen](help/Settings)
* [Plugins](help/Plugins) * [Plugins](help/Plugins)
* [Konnektoren (Connectors) installieren (Twitter/GNU Social)](help/Installing-Connectors) * [Konnektoren (Connectors) installieren (Twitter/GNU Social)](help/Installing-Connectors)
* [Installation eines ejabberd Servers (XMPP-Chat) mit synchronisierten Anmeldedaten](help/install-ejabberd) (EN)
* [Nachrichtenfluss](help/Message-Flow) * [Nachrichtenfluss](help/Message-Flow)
* [Betreibe deine Seite mit einem SSL-Zertifikat](help/SSL) * [Betreibe deine Seite mit einem SSL-Zertifikat](help/SSL)
* [Entwickler](help/Developers) * [Entwickler](help/Developers)

View File

@ -53,9 +53,21 @@ In the descirption and location field you can use BBCode to format the text.
When you *Share* the event it will be posted to your wall with the access permissions you've selected. When you *Share* the event it will be posted to your wall with the access permissions you've selected.
But before you do, you can also *preview* the event in a pop-up box. But before you do, you can also *preview* the event in a pop-up box.
### Interaction with Events
When you publish an event, you can choose who shall receive it, as with a regular new posting.
The recipients will see the posting about the event in their network-stream.
Additionally it will be added to their calendar and thus be shown in their events overview page.
Recipients of the event-posting can comment or dis-/like the event, as with a regular posting, but also announce that they will attend, not attend or may-be attend the event with a single click.
### Addons ### Addons
#### OpenStreetMap #### OpenStreetMap
If this addon is activated on you friendica node, the content of the location field will be mathced with the identification service of OSM when you submit the event. If this addon is activated on you friendica node, the content of the location field will be mathced with the identification service of OSM when you submit the event.
Should OSM find anything matching, a map for the location will be embedded automatically at the end of the events view. Should OSM find anything matching, a map for the location will be embedded automatically at the end of the events view.
#### Calendar Export
If this addon is activated the public events you have created will be published in ical or csv file. The URL of the published file is ``example.com/cal/nickname/export/format`` (where format is either ical of csv).

45
doc/install-ejabberd.md Normal file
View File

@ -0,0 +1,45 @@
Install an ejabberd with synchronized credentials
=================================================
* [Home](help)
[Ejabberd](https://www.ejabberd.im/) is a chat server that uses XMPP as messaging protocol that you can use with a large amount of clients. In conjunction
with the "xmpp" addon it can be used for a web based chat solution for your users.
Installation
------------
- Change it's owner to whichever user is running the server, ie. ejabberd
$ chown ejabberd:ejabberd /path/to/friendica/include/auth_ejabberd.php
- Change the access mode so it is readable only to the user ejabberd and has exec
$ chmod 700 /path/to/friendica/include/auth_ejabberd.php
- Edit your ejabberd.cfg file, comment out your auth_method and add:
{auth_method, external}.
{extauth_program, "/path/to/friendica/include/auth_ejabberd.php"}.
- Disable the module "mod_register" and disable the registration:
{access, register, [{deny, all}]}.
- Enable BOSH:
- Enable the module "mod_http_bind"
- Edit this line:
{5280, ejabberd_http, [captcha, http_poll, http_bind]}
- In your apache configuration for your site add this line:
ProxyPass /http-bind http://127.0.0.1:5280/http-bind retry=0
- Restart your ejabberd service, you should be able to login with your friendica credentials
Other hints
-----------
- if a user has a space or a @ in the nickname, the user has to replace these characters:
- " " (space) is replaced with "%20"
- "@" is replaced with "(a)"

View File

@ -30,6 +30,7 @@ Friendica Documentation and Resources
* [Settings](help/Settings) * [Settings](help/Settings)
* [Plugins](help/Plugins) * [Plugins](help/Plugins)
* [Installing Connectors (Twitter/GNU Social)](help/Installing-Connectors) * [Installing Connectors (Twitter/GNU Social)](help/Installing-Connectors)
* [Install an ejabberd server (XMPP chat) with synchronized credentials](help/install-ejabberd)
* [Message Flow](help/Message-Flow) * [Message Flow](help/Message-Flow)
* [Using SSL with Friendica](help/SSL) * [Using SSL with Friendica](help/SSL)
* [Developers](help/Developers) * [Developers](help/Developers)

View File

@ -285,7 +285,7 @@
* Unique contact to contact url. * Unique contact to contact url.
*/ */
function api_unique_id_to_url($id){ function api_unique_id_to_url($id){
$r = q("SELECT url FROM unique_contacts WHERE id=%d LIMIT 1", $r = q("SELECT `url` FROM `unique_contacts` WHERE `id`=%d LIMIT 1",
intval($id)); intval($id));
if ($r) if ($r)
return ($r[0]["url"]); return ($r[0]["url"]);
@ -390,9 +390,9 @@
$r = array(); $r = array();
if ($url != "") if ($url != "")
$r = q("SELECT * FROM unique_contacts WHERE url='%s' LIMIT 1", $url); $r = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1", $url);
elseif ($nick != "") elseif ($nick != "")
$r = q("SELECT * FROM unique_contacts WHERE nick='%s' LIMIT 1", $nick); $r = q("SELECT * FROM `unique_contacts` WHERE `nick`='%s' LIMIT 1", $nick);
if ($r) { if ($r) {
// If no nick where given, extract it from the address // If no nick where given, extract it from the address
@ -505,14 +505,14 @@
} }
// Fetching unique id // Fetching unique id
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url']))); $r = q("SELECT id FROM `unique_contacts` WHERE `url`='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url'])));
// If not there, then add it // If not there, then add it
if (count($r) == 0) { if (count($r) == 0) {
q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')", q("INSERT INTO `unique_contacts` (`url`, `name`, `nick`, `avatar`) VALUES ('%s', '%s', '%s', '%s')",
dbesc(normalise_link($uinfo[0]['url'])), dbesc($uinfo[0]['name']),dbesc($uinfo[0]['nick']), dbesc($uinfo[0]['micro'])); dbesc(normalise_link($uinfo[0]['url'])), dbesc($uinfo[0]['name']),dbesc($uinfo[0]['nick']), dbesc($uinfo[0]['micro']));
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url']))); $r = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url'])));
} }
$network_name = network_to_name($uinfo[0]['network'], $uinfo[0]['url']); $network_name = network_to_name($uinfo[0]['network'], $uinfo[0]['url']);
@ -539,7 +539,8 @@
'verified' => true, 'verified' => true,
'statusnet_blocking' => false, 'statusnet_blocking' => false,
'notifications' => false, 'notifications' => false,
'statusnet_profile_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'], //'statusnet_profile_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
'statusnet_profile_url' => $uinfo[0]['url'],
'uid' => intval($uinfo[0]['uid']), 'uid' => intval($uinfo[0]['uid']),
'cid' => intval($uinfo[0]['cid']), 'cid' => intval($uinfo[0]['cid']),
'self' => $uinfo[0]['self'], 'self' => $uinfo[0]['self'],
@ -552,36 +553,44 @@
function api_item_get_user(&$a, $item) { function api_item_get_user(&$a, $item) {
$author = q("SELECT * FROM unique_contacts WHERE url='%s' LIMIT 1", $author = q("SELECT * FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
dbesc(normalise_link($item['author-link']))); dbesc(normalise_link($item['author-link'])));
if (count($author) == 0) { if (count($author) == 0) {
q("INSERT INTO unique_contacts (url, name, avatar) VALUES ('%s', '%s', '%s')", q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`) VALUES ('%s', '%s', '%s')",
dbesc(normalise_link($item["author-link"])), dbesc($item["author-name"]), dbesc($item["author-avatar"])); dbesc(normalise_link($item["author-link"])), dbesc($item["author-name"]), dbesc($item["author-avatar"]));
$author = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", $author = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
dbesc(normalise_link($item['author-link']))); dbesc(normalise_link($item['author-link'])));
} else if ($item["author-link"].$item["author-name"] != $author[0]["url"].$author[0]["name"]) { } else if ($item["author-link"].$item["author-name"] != $author[0]["url"].$author[0]["name"]) {
q("UPDATE unique_contacts SET name = '%s', avatar = '%s' WHERE (`name` != '%s' OR `avatar` != '%s') AND url = '%s'", $r = q("SELECT `id` FROM `unique_contacts` WHERE `name` = '%s' AND `avatar` = '%s' AND url = '%s'",
dbesc($item["author-name"]), dbesc($item["author-avatar"]), dbesc($item["author-name"]), dbesc($item["author-avatar"]),
dbesc($item["author-name"]), dbesc($item["author-avatar"]), dbesc(normalise_link($item["author-link"])));
dbesc(normalise_link($item["author-link"])));
if (!$r)
q("UPDATE `unique_contacts` SET `name` = '%s', `avatar` = '%s' WHERE `url` = '%s'",
dbesc($item["author-name"]), dbesc($item["author-avatar"]),
dbesc(normalise_link($item["author-link"])));
} }
$owner = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", $owner = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
dbesc(normalise_link($item['owner-link']))); dbesc(normalise_link($item['owner-link'])));
if (count($owner) == 0) { if (count($owner) == 0) {
q("INSERT INTO unique_contacts (url, name, avatar) VALUES ('%s', '%s', '%s')", q("INSERT INTO `unique_contacts` (`url`, `name`, `avatar`) VALUES ('%s', '%s', '%s')",
dbesc(normalise_link($item["owner-link"])), dbesc($item["owner-name"]), dbesc($item["owner-avatar"])); dbesc(normalise_link($item["owner-link"])), dbesc($item["owner-name"]), dbesc($item["owner-avatar"]));
$owner = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", $owner = q("SELECT `id` FROM `unique_contacts` WHERE `url`='%s' LIMIT 1",
dbesc(normalise_link($item['owner-link']))); dbesc(normalise_link($item['owner-link'])));
} else if ($item["owner-link"].$item["owner-name"] != $owner[0]["url"].$owner[0]["name"]) { } else if ($item["owner-link"].$item["owner-name"] != $owner[0]["url"].$owner[0]["name"]) {
q("UPDATE unique_contacts SET name = '%s', avatar = '%s' WHERE (`name` != '%s' OR `avatar` != '%s') AND url = '%s'", $r = q("SELECT `id` FROM `unique_contacts` WHERE `name` = '%s' AND `avatar` = '%s' AND url = '%s'",
dbesc($item["owner-name"]), dbesc($item["owner-avatar"]), dbesc($item["owner-name"]), dbesc($item["owner-avatar"]),
dbesc($item["owner-name"]), dbesc($item["owner-avatar"]), dbesc(normalise_link($item["owner-link"])));
dbesc(normalise_link($item["owner-link"])));
if (!$r)
q("UPDATE `unique_contacts` SET `name` = '%s', `avatar` = '%s' WHERE `url` = '%s'",
dbesc($item["owner-name"]), dbesc($item["owner-avatar"]),
dbesc(normalise_link($item["owner-link"])));
} }
// Comments in threads may appear as wall-to-wall postings. // Comments in threads may appear as wall-to-wall postings.
@ -952,7 +961,7 @@
$in_reply_to_status_id= intval($lastwall['parent']); $in_reply_to_status_id= intval($lastwall['parent']);
$in_reply_to_status_id_str = (string) intval($lastwall['parent']); $in_reply_to_status_id_str = (string) intval($lastwall['parent']);
$r = q("SELECT * FROM unique_contacts WHERE `url` = '%s'", dbesc(normalise_link($lastwall['item-author']))); $r = q("SELECT * FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($lastwall['item-author'])));
if ($r) { if ($r) {
if ($r[0]['nick'] == "") if ($r[0]['nick'] == "")
$r[0]['nick'] = api_get_nick($r[0]["url"]); $r[0]['nick'] = api_get_nick($r[0]["url"]);
@ -1074,7 +1083,7 @@
$in_reply_to_status_id = intval($lastwall['parent']); $in_reply_to_status_id = intval($lastwall['parent']);
$in_reply_to_status_id_str = (string) intval($lastwall['parent']); $in_reply_to_status_id_str = (string) intval($lastwall['parent']);
$r = q("SELECT * FROM unique_contacts WHERE `url` = '%s'", dbesc(normalise_link($reply[0]['item-author']))); $r = q("SELECT * FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($reply[0]['item-author'])));
if ($r) { if ($r) {
if ($r[0]['nick'] == "") if ($r[0]['nick'] == "")
$r[0]['nick'] = api_get_nick($r[0]["url"]); $r[0]['nick'] = api_get_nick($r[0]["url"]);
@ -1135,9 +1144,9 @@
$userlist = array(); $userlist = array();
if (isset($_GET["q"])) { if (isset($_GET["q"])) {
$r = q("SELECT id FROM unique_contacts WHERE name='%s'", dbesc($_GET["q"])); $r = q("SELECT id FROM `unique_contacts` WHERE `name`='%s'", dbesc($_GET["q"]));
if (!count($r)) if (!count($r))
$r = q("SELECT id FROM unique_contacts WHERE nick='%s'", dbesc($_GET["q"])); $r = q("SELECT `id` FROM `unique_contacts` WHERE `nick`='%s'", dbesc($_GET["q"]));
if (count($r)) { if (count($r)) {
foreach ($r AS $user) { foreach ($r AS $user) {
@ -2180,7 +2189,7 @@
intval(api_user()), intval(api_user()),
intval($in_reply_to_status_id)); intval($in_reply_to_status_id));
if ($r) { if ($r) {
$r = q("SELECT * FROM unique_contacts WHERE `url` = '%s'", dbesc(normalise_link($r[0]['author-link']))); $r = q("SELECT * FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($r[0]['author-link'])));
if ($r) { if ($r) {
if ($r[0]['nick'] == "") if ($r[0]['nick'] == "")
@ -2439,7 +2448,7 @@
$stringify_ids = (x($_REQUEST,'stringify_ids')?$_REQUEST['stringify_ids']:false); $stringify_ids = (x($_REQUEST,'stringify_ids')?$_REQUEST['stringify_ids']:false);
$r = q("SELECT unique_contacts.id FROM contact, unique_contacts WHERE contact.nurl = unique_contacts.url AND `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra", $r = q("SELECT `unique_contact`.`id` FROM contact, `unique_contacts` WHERE contact.nurl = unique_contacts.url AND `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",
intval(api_user()) intval(api_user())
); );
@ -2841,15 +2850,29 @@ function api_share_as_retweet(&$item) {
function api_get_nick($profile) { function api_get_nick($profile) {
/* To-Do: /* To-Do:
- remove trailing jung from profile url - remove trailing junk from profile url
- pump.io check has to check the website - pump.io check has to check the website
*/ */
$nick = ""; $nick = "";
$friendica = preg_replace("=https?://(.*)/profile/(.*)=ism", "$2", $profile); $r = q("SELECT `nick` FROM `gcontact` WHERE `nurl` = '%s'",
if ($friendica != $profile) dbesc(normalise_link($profile)));
$nick = $friendica; if ($r)
$nick = $r[0]["nick"];
if (!$nick == "") {
$r = q("SELECT `nick` FROM `contact` WHERE `uid` = 0 AND `nurl` = '%s'",
dbesc(normalise_link($profile)));
if ($r)
$nick = $r[0]["nick"];
}
if (!$nick == "") {
$friendica = preg_replace("=https?://(.*)/profile/(.*)=ism", "$2", $profile);
if ($friendica != $profile)
$nick = $friendica;
}
if (!$nick == "") { if (!$nick == "") {
$diaspora = preg_replace("=https?://(.*)/u/(.*)=ism", "$2", $profile); $diaspora = preg_replace("=https?://(.*)/u/(.*)=ism", "$2", $profile);
@ -2887,7 +2910,7 @@ function api_get_nick($profile) {
//} //}
if ($nick != "") { if ($nick != "") {
q("UPDATE unique_contacts SET nick = '%s' WHERE `nick` != '%s' AND url = '%s'", q("UPDATE `unique_contacts` SET `nick` = '%s' WHERE `nick` != '%s' AND url = '%s'",
dbesc($nick), dbesc($nick), dbesc(normalise_link($profile))); dbesc($nick), dbesc($nick), dbesc(normalise_link($profile)));
return($nick); return($nick);
} }

View File

@ -100,7 +100,7 @@ function localize_item(&$item){
$item['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $item['contact-id']); $item['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $item['contact-id']);
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
if (activity_match($item['verb'],ACTIVITY_LIKE) if (activity_match($item['verb'],ACTIVITY_LIKE)
|| activity_match($item['verb'],ACTIVITY_DISLIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)
|| activity_match($item['verb'],ACTIVITY_ATTEND) || activity_match($item['verb'],ACTIVITY_ATTEND)
|| activity_match($item['verb'],ACTIVITY_ATTENDNO) || activity_match($item['verb'],ACTIVITY_ATTENDNO)
@ -984,15 +984,15 @@ function builtin_activity_puller($item, &$conv_responses) {
$url = z_root(true) . '/redir/' . $item['contact-id']; $url = z_root(true) . '/redir/' . $item['contact-id'];
$sparkle = ' class="sparkle" '; $sparkle = ' class="sparkle" ';
} }
else else
$url = zrl($url); $url = zrl($url);
$url = '<a href="'. $url . '"'. $sparkle .'>' . htmlentities($item['author-name']) . '</a>'; $url = '<a href="'. $url . '"'. $sparkle .'>' . htmlentities($item['author-name']) . '</a>';
if(! $item['thr-parent']) if(! $item['thr-parent'])
$item['thr-parent'] = $item['parent-uri']; $item['thr-parent'] = $item['parent-uri'];
if(! ((isset($conv_responses[$mode][$item['thr-parent'] . '-l'])) if(! ((isset($conv_responses[$mode][$item['thr-parent'] . '-l']))
&& (is_array($conv_responses[$mode][$item['thr-parent'] . '-l'])))) && (is_array($conv_responses[$mode][$item['thr-parent'] . '-l']))))
$conv_responses[$mode][$item['thr-parent'] . '-l'] = array(); $conv_responses[$mode][$item['thr-parent'] . '-l'] = array();
@ -1064,9 +1064,9 @@ function format_like($cnt,$arr,$type,$id) {
} }
$likers = $str; $likers = $str;
$spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\""; $spanatts = "class=\"fakelink\" onclick=\"openClose('{$type}list-$id');\"";
switch($type) { switch($type) {
case 'like': case 'like':
$phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt); $phrase = sprintf( t('<span %1$s>%2$d people</span> like this'), $spanatts, $cnt);
@ -1291,6 +1291,15 @@ function conv_sort($arr,$order) {
$parents = array(); $parents = array();
$children = array(); $children = array();
$newarr = array();
// This is a preparation for having two different items with the same uri in one thread
// This will otherwise lead to an endless loop.
foreach($arr as $x)
if (!isset($newarr[$x['uri']]))
$newarr[$x['uri']] = $x;
$arr = $newarr;
foreach($arr as $x) foreach($arr as $x)
if($x['id'] == $x['parent']) if($x['id'] == $x['parent'])

View File

@ -340,9 +340,9 @@ function delivery_run(&$argv, &$argc){
$ssl_policy = get_config('system','ssl_policy'); $ssl_policy = get_config('system','ssl_policy');
fix_contact_ssl_policy($x[0],$ssl_policy); fix_contact_ssl_policy($x[0],$ssl_policy);
// If we are setup as a soapbox we aren't accepting input from this person // If we are setup as a soapbox we aren't accepting top level posts from this person
if($x[0]['page-flags'] == PAGE_SOAPBOX) if (($x[0]['page-flags'] == PAGE_SOAPBOX) AND $top_level)
break; break;
require_once('library/simplepie/simplepie.inc'); require_once('library/simplepie/simplepie.inc');

View File

@ -1,19 +1,54 @@
<?php <?php
/* /**
* Features management * @file include/features.php *
* @brief Features management
*/ */
/**
* @brief check if feature is enabled
*
* return boolean
*/
function feature_enabled($uid,$feature) { function feature_enabled($uid,$feature) {
//return true; //return true;
$x = get_pconfig($uid,'feature',$feature); $x = get_pconfig($uid,'feature',$feature);
if($x === false) {
$x = get_config('feature',$feature);
if($x === false)
$x = get_feature_default($feature);
}
$arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x); $arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
call_hooks('feature_enabled',$arr); call_hooks('feature_enabled',$arr);
return($arr['enabled']); 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
*
* @return array
*/
function get_features() { function get_features() {
$arr = array( $arr = array(
@ -22,46 +57,53 @@ function get_features() {
'general' => array( 'general' => array(
t('General Features'), t('General Features'),
//array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')), //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')), array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple 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), 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),
), ),
// Post composition // Post composition
'composition' => array( 'composition' => array(
t('Post Composition Features'), t('Post Composition Features'),
array('richtext', t('Richtext Editor'), t('Enable richtext editor')), array('richtext', t('Richtext Editor'), t('Enable richtext editor'),false),
array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')), array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'),false),
array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a fourm page is selected/deselected in ACL window.')), array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a fourm page is selected/deselected in ACL window.'),false),
), ),
// Network sidebar widgets // Network sidebar widgets
'widgets' => array( 'widgets' => array(
t('Network Sidebar Widgets'), t('Network Sidebar Widgets'),
array('archives', t('Search by Date'), t('Ability to select posts by date ranges')), array('archives', t('Search by Date'), t('Ability to select posts by date ranges'),false),
array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group')), array('forumlist_widget', t('List Forums'), t('Enable widget to display the forums your are connected with'),true),
array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network')), array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group'),false),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')), array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network'),false),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'),false),
), ),
// Network tabs // Network tabs
'net_tabs' => array( 'net_tabs' => array(
t('Network Tabs'), t('Network Tabs'),
array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')), array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'),false),
array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)')), array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)'),false),
array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them')), array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them'),false),
), ),
// Item tools // Item tools
'tools' => array( 'tools' => array(
t('Post/Comment Tools'), t('Post/Comment Tools'),
array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')), array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once'),false),
array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')), array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending'),false),
array('commtag', t('Tagging'), t('Ability to tag existing posts')), array('commtag', t('Tagging'), t('Ability to tag existing posts'),false),
array('categories', t('Post Categories'), t('Add categories to your posts')), array('categories', t('Post Categories'), t('Add categories to your posts'),false),
array('filing', t('Saved Folders'), t('Ability to file posts under folders')), array('filing', t('Saved Folders'), t('Ability to file posts under folders'),false),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')), array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')), array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'),false),
array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread')), array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread'),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),
), ),
); );

149
include/forums.php Normal file
View File

@ -0,0 +1,149 @@
<?php
/**
* @file include/forums.php
* @brief Functions related to forum functionality *
*/
/**
* @brief Function to list all forums a user is connected with
*
* @param int $uid of the profile owner
* @param boolean $showhidden
* Show frorums which are not hidden
* @param boolean $lastitem
* Sort by lastitem
* @param boolean $showprivate
* Show private groups
*
* @returns array
* 'url' => forum url
* 'name' => forum name
* 'id' => number of the key from the array
* 'micro' => contact photo in format micro
*/
function get_forumlist($uid, $showhidden = true, $lastitem, $showprivate = false) {
$forumlist = array();
$order = (($showhidden) ? '' : ' AND NOT `hidden` ');
$order .= (($lastitem) ? ' ORDER BY `last-item` DESC ' : ' ORDER BY `name` ASC ');
$select = '`forum` ';
if ($showprivate) {
$select = '(`forum` OR `prv`)';
}
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro` FROM `contact`
WHERE `network`= 'dfrn' AND $select AND `uid` = %d
AND NOT `blocked` AND NOT `hidden` AND NOT `pending` AND NOT `archive`
AND `success_update` > `failure_update`
$order ",
intval($uid)
);
foreach($contacts as $contact) {
$forumlist[] = array(
'url' => $contact['url'],
'name' => $contact['name'],
'id' => $contact['id'],
'micro' => $contact['micro'],
);
}
return($forumlist);
}
/**
* @brief Forumlist widget
*
* Sidebar widget to show subcribed friendica forums. If activated
* in the settings, it appears at the notwork page sidebar
*
* @param App $a
* @return string
*/
function widget_forumlist($a) {
if(! intval(feature_enabled(local_user(),'forumlist_widget')))
return;
$o = '';
//sort by last updated item
$lastitem = true;
$contacts = get_forumlist($a->user['uid'],true,$lastitem, true);
$total = count($contacts);
$visible_forums = 10;
if(count($contacts)) {
$id = 0;
foreach($contacts as $contact) {
$entry = array(
'url' => $a->get_baseurl() . '/network?f=&cid=' . $contact['id'],
'external_url' => $a->get_baseurl() . '/redir/' . $contact['id'],
'name' => $contact['name'],
'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO),
'id' => ++$id,
);
$entries[] = $entry;
}
$tpl = get_markup_template('widget_forumlist.tpl');
$o .= replace_macros($tpl,array(
'$title' => t('Forums'),
'$forums' => $entries,
'$link_desc' => t('External link to forum'),
'$total' => $total,
'$visible_forums' => $visible_forums,
'$showmore' => t('show more'),
));
}
return $o;
}
/**
* @brief Format forumlist as contact block
*
* This function is used to show the forumlist in
* the advanced profile.
*
* @param int $uid
* @return string
*
*/
function forumlist_profile_advanced($uid) {
$profile = intval(feature_enabled($uid,'forumlist_profile'));
if(! $profile)
return;
$o = '';
// place holder in case somebody wants configurability
$show_total = 9999;
//don't sort by last updated item
$lastitem = false;
$contacts = get_forumlist($uid,false,$lastitem,false);
$total_shown = 0;
foreach($contacts as $contact) {
$forumlist .= micropro($contact,false,'forumlist-profile-advanced');
$total_shown ++;
if($total_shown == $show_total)
break;
}
if(count($contacts) > 0)
$o .= $forumlist;
return $o;
}

View File

@ -85,14 +85,16 @@ function deletenode(&$doc, $node)
$child->parentNode->removeChild($child); $child->parentNode->removeChild($child);
}} }}
function _replace_code_cb($m){
return "<code>".str_replace("\n","<br>\n",$m[1]). "</code>";
}
function html2bbcode($message) function html2bbcode($message)
{ {
$message = str_replace("\r", "", $message); $message = str_replace("\r", "", $message);
$message = preg_replace_callback("|<pre><code>([^<]*)</code></pre>|ism", function($m) { $message = preg_replace_callback("|<pre><code>([^<]*)</code></pre>|ism", "_replace_code_cb", $message);
return "<code>".str_replace("\n","<br>\n",$m[1]). "</code>";
}, $message);
$message = str_replace(array( $message = str_replace(array(
"<li><p>", "<li><p>",

View File

@ -1,4 +1,9 @@
<?php <?php
/**
* @file include/identity.php
*/
require_once('include/forums.php');
/** /**
@ -59,15 +64,15 @@ if(! function_exists('profile_load')) {
$profile_int = intval($profile); $profile_int = intval($profile);
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d and `contact`.`self` = 1 LIMIT 1", WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d AND `contact`.`self` = 1 LIMIT 1",
dbesc($nickname), dbesc($nickname),
intval($profile_int) intval($profile_int)
); );
} }
if((!$r) && (!count($r))) { if((!$r) && (!count($r))) {
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1", WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 AND `contact`.`self` = 1 LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
} }
@ -82,7 +87,7 @@ if(! function_exists('profile_load')) {
// fetch user tags if this isn't the default profile // fetch user tags if this isn't the default profile
if(!$r[0]['is-default']) { if(!$r[0]['is-default']) {
$x = q("select `pub_keywords` from `profile` where uid = %d and `is-default` = 1 limit 1", $x = q("SELECT `pub_keywords` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($r[0]['profile_uid']) intval($r[0]['profile_uid'])
); );
if($x && count($x)) if($x && count($x))
@ -306,7 +311,7 @@ if(! function_exists('profile_sidebar')) {
if(count($r)) if(count($r))
$updated = date("c", strtotime($r[0]['updated'])); $updated = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0
AND `network` IN ('%s', '%s', '%s', '')", AND `network` IN ('%s', '%s', '%s', '')",
intval($profile['uid']), intval($profile['uid']),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
@ -525,8 +530,9 @@ if(! function_exists('get_events')) {
function advanced_profile(&$a) { function advanced_profile(&$a) {
$o = ''; $o = '';
$uid = $a->profile['uid'];
$o .= replace_macros(get_markup_template("section_title.tpl"),array( $o .= replace_macros(get_markup_template('section_title.tpl'),array(
'$title' => t('Profile') '$title' => t('Profile')
)); ));
@ -603,6 +609,11 @@ function advanced_profile(&$a) {
if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
//show subcribed forum if it is enabled in the usersettings
if (feature_enabled($uid,'forumlist_profile')) {
$profile['forumlist'] = array( t('Forums:'), forumlist_profile_advanced($uid));
}
if ($a->profile['uid'] == local_user()) if ($a->profile['uid'] == local_user())
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); $profile['edit'] = array($a->get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile'));

View File

@ -2381,85 +2381,45 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$contact_updated = $photo_timestamp; $contact_updated = $photo_timestamp;
require_once("include/Photo.php"); require_once("include/Photo.php");
$photo_failure = false; $photos = import_profile_photo($photo_url,$contact['uid'],$contact['id']);
$have_photo = false;
$r = q("SELECT `resource-id` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d LIMIT 1", q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
intval($contact['id']), WHERE `uid` = %d AND `id` = %d AND NOT `self`",
intval($contact['uid']) dbesc(datetime_convert()),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
intval($contact['uid']),
intval($contact['id'])
); );
if(count($r)) {
$resource_id = $r[0]['resource-id'];
$have_photo = true;
}
else {
$resource_id = photo_new_resource();
}
$img_str = fetch_url($photo_url,true);
// guess mimetype from headers or filename
$type = guess_image_type($photo_url,true);
$img = new Photo($img_str, $type);
if($img->is_valid()) {
if($have_photo) {
q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `contact-id` = %d AND `uid` = %d",
dbesc($resource_id),
intval($contact['id']),
intval($contact['uid'])
);
}
$img->scaleImageSquare(175);
$hash = $resource_id;
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), 'Contact Photos', 4);
$img->scaleImage(80);
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), 'Contact Photos', 5);
$img->scaleImage(48);
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), 'Contact Photos', 6);
$a = get_app();
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
WHERE `uid` = %d AND `id` = %d",
dbesc(datetime_convert()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-6.'.$img->getExt()),
intval($contact['uid']),
intval($contact['id'])
);
}
} }
if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) { if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
if ($name_updated > $contact_updated) if ($name_updated > $contact_updated)
$contact_updated = $name_updated; $contact_updated = $name_updated;
$r = q("select * from contact where uid = %d and id = %d limit 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($contact['uid']), intval($contact['uid']),
intval($contact['id']) intval($contact['id'])
); );
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d", $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d AND `name` != '%s' AND NOT `self`",
dbesc(notags(trim($new_name))), dbesc(notags(trim($new_name))),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($contact['uid']), intval($contact['uid']),
intval($contact['id']) intval($contact['id']),
dbesc(notags(trim($new_name)))
); );
// do our best to update the name on content items // do our best to update the name on content items
if(count($r)) { if(count($r) AND (notags(trim($new_name)) != $r[0]['name'])) {
q("update item set `author-name` = '%s' where `author-name` = '%s' and `author-link` = '%s' and uid = %d", q("UPDATE `item` SET `author-name` = '%s' WHERE `author-name` = '%s' AND `author-link` = '%s' AND `uid` = %d AND `author-name` != '%s'",
dbesc(notags(trim($new_name))), dbesc(notags(trim($new_name))),
dbesc($r[0]['name']), dbesc($r[0]['name']),
dbesc($r[0]['url']), dbesc($r[0]['url']),
intval($contact['uid']) intval($contact['uid']),
dbesc(notags(trim($new_name)))
); );
} }
} }
@ -3119,85 +3079,46 @@ function local_delivery($importer,$data) {
logger('local_delivery: Updating photo for ' . $importer['name']); logger('local_delivery: Updating photo for ' . $importer['name']);
require_once("include/Photo.php"); require_once("include/Photo.php");
$photo_failure = false;
$have_photo = false;
$r = q("SELECT `resource-id` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d LIMIT 1", $photos = import_profile_photo($photo_url,$importer['importer_uid'],$importer['id']);
intval($importer['id']),
intval($importer['importer_uid']) q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
WHERE `uid` = %d AND `id` = %d AND NOT `self`",
dbesc(datetime_convert()),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
intval($importer['importer_uid']),
intval($importer['id'])
); );
if(count($r)) {
$resource_id = $r[0]['resource-id'];
$have_photo = true;
}
else {
$resource_id = photo_new_resource();
}
$img_str = fetch_url($photo_url,true);
// guess mimetype from headers or filename
$type = guess_image_type($photo_url,true);
$img = new Photo($img_str, $type);
if($img->is_valid()) {
if($have_photo) {
q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `contact-id` = %d AND `uid` = %d",
dbesc($resource_id),
intval($importer['id']),
intval($importer['importer_uid'])
);
}
$img->scaleImageSquare(175);
$hash = $resource_id;
$r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 4);
$img->scaleImage(80);
$r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 5);
$img->scaleImage(48);
$r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 6);
$a = get_app();
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
WHERE `uid` = %d AND `id` = %d",
dbesc(datetime_convert()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-6.'.$img->getExt()),
intval($importer['importer_uid']),
intval($importer['id'])
);
}
} }
if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name-date'])) { if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name-date'])) {
if ($name_updated > $contact_updated) if ($name_updated > $contact_updated)
$contact_updated = $name_updated; $contact_updated = $name_updated;
$r = q("select * from contact where uid = %d and id = %d limit 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($importer['importer_uid']), intval($importer['importer_uid']),
intval($importer['id']) intval($importer['id'])
); );
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d", $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d AND `name` != '%s' AND NOT `self`",
dbesc(notags(trim($new_name))), dbesc(notags(trim($new_name))),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($importer['importer_uid']), intval($importer['importer_uid']),
intval($importer['id']) intval($importer['id']),
dbesc(notags(trim($new_name)))
); );
// do our best to update the name on content items // do our best to update the name on content items
if(count($r)) { if(count($r) AND (notags(trim($new_name)) != $r[0]['name'])) {
q("update item set `author-name` = '%s' where `author-name` = '%s' and `author-link` = '%s' and uid = %d", q("UPDATE `item` SET `author-name` = '%s' WHERE `author-name` = '%s' AND `author-link` = '%s' AND `uid` = %d AND `author-name` != '%s'",
dbesc(notags(trim($new_name))), dbesc(notags(trim($new_name))),
dbesc($r[0]['name']), dbesc($r[0]['name']),
dbesc($r[0]['url']), dbesc($r[0]['url']),
intval($importer['importer_uid']) intval($importer['importer_uid']),
dbesc(notags(trim($new_name)))
); );
} }
} }

View File

@ -734,9 +734,9 @@ function notifier_run(&$argv, &$argc){
$ssl_policy = get_config('system','ssl_policy'); $ssl_policy = get_config('system','ssl_policy');
fix_contact_ssl_policy($x[0],$ssl_policy); fix_contact_ssl_policy($x[0],$ssl_policy);
// If we are setup as a soapbox we aren't accepting input from this person // If we are setup as a soapbox we aren't accepting top level posts from this person
if($x[0]['page-flags'] == PAGE_SOAPBOX) if (($x[0]['page-flags'] == PAGE_SOAPBOX) AND $top_level)
break; break;
require_once('library/simplepie/simplepie.inc'); require_once('library/simplepie/simplepie.inc');

View File

@ -1,7 +1,17 @@
<?php <?php
/**
* @file include/identity.php
*
* @brief Some functions to handle addons and themes.
*/
// install and uninstall plugin /**
* @brief uninstalls an addon.
*
* @param string $plugin name of the addon
* @return boolean
*/
if (! function_exists('uninstall_plugin')){ if (! function_exists('uninstall_plugin')){
function uninstall_plugin($plugin){ function uninstall_plugin($plugin){
logger("Addons: uninstalling " . $plugin); logger("Addons: uninstalling " . $plugin);
@ -16,6 +26,12 @@ function uninstall_plugin($plugin){
} }
}} }}
/**
* @brief installs an addon.
*
* @param string $plugin name of the addon
* @return bool
*/
if (! function_exists('install_plugin')){ if (! function_exists('install_plugin')){
function install_plugin($plugin) { function install_plugin($plugin) {
// silently fail if plugin was removed // silently fail if plugin was removed
@ -42,7 +58,7 @@ function install_plugin($plugin) {
// This way the system won't fall over dead during the update. // This way the system won't fall over dead during the update.
if(file_exists('addon/' . $plugin . '/.hidden')) { if(file_exists('addon/' . $plugin . '/.hidden')) {
q("update addon set hidden = 1 where name = '%s'", q("UPDATE `addon` SET `hidden` = 1 WHERE `name` = '%s'",
dbesc($plugin) dbesc($plugin)
); );
} }
@ -105,10 +121,27 @@ function reload_plugins() {
}} }}
/**
* @brief check if addon is enabled
*
* @param string $plugin
* @return boolean
*/
function plugin_enabled($plugin) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin);
return((bool)(count($r) > 0));
}
/**
* @brief registers a hook.
*
* @param string $hook the name of the hook
* @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook will call
* @param int $priority A priority (defaults to 0)
* @return mixed|bool
*/
if(! function_exists('register_hook')) { if(! function_exists('register_hook')) {
function register_hook($hook,$file,$function,$priority=0) { function register_hook($hook,$file,$function,$priority=0) {
@ -129,6 +162,14 @@ function register_hook($hook,$file,$function,$priority=0) {
return $r; return $r;
}} }}
/**
* @brief unregisters a hook.
*
* @param string $hook the name of the hook
* @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook called
* @return array
*/
if(! function_exists('unregister_hook')) { if(! function_exists('unregister_hook')) {
function unregister_hook($hook,$file,$function) { function unregister_hook($hook,$file,$function) {
@ -155,7 +196,15 @@ function load_hooks() {
} }
}} }}
/**
* @brief Calls a hook.
*
* Use this function when you want to be able to allow a hook to manipulate
* the provided data.
*
* @param string $name of the hook to call
* @param string|array &$data to transmit to the callback handler
*/
if(! function_exists('call_hooks')) { if(! function_exists('call_hooks')) {
function call_hooks($name, &$data = null) { function call_hooks($name, &$data = null) {
$stamp1 = microtime(true); $stamp1 = microtime(true);
@ -178,7 +227,7 @@ function call_hooks($name, &$data = null) {
} }
else { else {
// remove orphan hooks // remove orphan hooks
q("delete from hook where hook = '%s' and file = '%s' and function = '%s'", q("DELETE FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s'",
dbesc($name), dbesc($name),
dbesc($hook[0]), dbesc($hook[0]),
dbesc($hook[1]) dbesc($hook[1])
@ -204,16 +253,20 @@ function plugin_is_app($name) {
return false; return false;
}} }}
/* /**
* parse plugin comment in search of plugin infos. * @brief Parse plugin comment in search of plugin infos.
* like
* *
* * Name: Plugin * like
* \code
*...* Name: Plugin
* * Description: A plugin which plugs in * * Description: A plugin which plugs in
* * Version: 1.2.3 * . * Version: 1.2.3
* * Author: John <profile url> * * Author: John <profile url>
* * Author: Jane <email> * * Author: Jane <email>
* * * *
* *\endcode
* @param string $plugin the name of the plugin
* @return array with the plugin information
*/ */
if (! function_exists('get_plugin_info')){ if (! function_exists('get_plugin_info')){
@ -265,16 +318,20 @@ function get_plugin_info($plugin){
}} }}
/* /**
* parse theme comment in search of theme infos. * @brief Parse theme comment in search of theme infos.
*
* like * like
* * \code
* * Name: My Theme * ..* Name: My Theme
* * Description: My Cool Theme * * Description: My Cool Theme
* * Version: 1.2.3 * . * Version: 1.2.3
* * Author: John <profile url> * * Author: John <profile url>
* * Maintainer: Jane <profile url> * * Maintainer: Jane <profile url>
* * * *
* \endcode
* @param string $theme the name of the theme
* @return array
*/ */
if (! function_exists('get_theme_info')){ if (! function_exists('get_theme_info')){
@ -340,7 +397,14 @@ function get_theme_info($theme){
return $info; return $info;
}} }}
/**
* @brief Returns the theme's screenshot.
*
* The screenshot is expected as view/theme/$theme/screenshot.[png|jpg].
*
* @param sring $theme The name of the theme
* @return string
*/
function get_theme_screenshot($theme) { function get_theme_screenshot($theme) {
$a = get_app(); $a = get_app();
$exts = array('.png','.jpg'); $exts = array('.png','.jpg');
@ -402,7 +466,7 @@ function service_class_allows($uid,$property,$usage = false) {
$service_class = $a->user['service_class']; $service_class = $a->user['service_class'];
} }
else { else {
$r = q("select service_class from user where uid = %d limit 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
if($r !== false and count($r)) { if($r !== false and count($r)) {
@ -432,7 +496,7 @@ function service_class_fetch($uid,$property) {
$service_class = $a->user['service_class']; $service_class = $a->user['service_class'];
} }
else { else {
$r = q("select service_class from user where uid = %d limit 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
if($r !== false and count($r)) { if($r !== false and count($r)) {

View File

@ -20,6 +20,10 @@ function replace_macros($s,$r) {
$stamp1 = microtime(true); $stamp1 = microtime(true);
$a = get_app(); $a = get_app();
// pass $baseurl to all templates
$r['$baseurl'] = $a->get_baseurl();
$t = $a->template_engine(); $t = $a->template_engine();
try { try {

View File

@ -135,7 +135,7 @@ function admin_content(&$a) {
/* get plugins admin page */ /* get plugins admin page */
$r = q("SELECT name FROM `addon` WHERE `plugin_admin`=1"); $r = q("SELECT `name` FROM `addon` WHERE `plugin_admin`=1 ORDER BY `name`");
$aside['plugins_admin']=Array(); $aside['plugins_admin']=Array();
foreach ($r as $h){ foreach ($r as $h){
$plugin =$h['name']; $plugin =$h['name'];

View File

@ -476,8 +476,8 @@ function dfrn_poll_content(&$a) {
// URL reply // URL reply
if($dfrn_version < 2.2) { if($dfrn_version < 2.2) {
$s = fetch_url($r[0]['poll'] $s = fetch_url($r[0]['poll']
. '?dfrn_id=' . $encrypted_id . '?dfrn_id=' . $encrypted_id
. '&type=profile-check' . '&type=profile-check'
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
. '&challenge=' . $challenge . '&challenge=' . $challenge
@ -493,7 +493,7 @@ function dfrn_poll_content(&$a) {
'sec' => $sec 'sec' => $sec
)); ));
} }
$profile = ((count($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname); $profile = ((count($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
switch($destination_url) { switch($destination_url) {
@ -506,7 +506,7 @@ function dfrn_poll_content(&$a) {
case 'status': case 'status':
case '': case '':
$dest = $a->get_baseurl() . '/profile/' . $profile; $dest = $a->get_baseurl() . '/profile/' . $profile;
break; break;
default: default:
$dest = $destination_url . '?f=&redir=1'; $dest = $destination_url . '?f=&redir=1';
break; break;
@ -564,5 +564,3 @@ function dfrn_poll_content(&$a) {
} }
} }
} }

View File

@ -11,6 +11,14 @@ function install_init(&$a){
echo "ok"; echo "ok";
killme(); killme();
} }
// We overwrite current theme css, because during install we could not have a working mod_rewrite
// so we could not have a css at all. Here we set a static css file for the install procedure pages
$a->config['system']['theme'] = "../install";
$a->theme['stylesheet'] = $a->get_baseurl()."/view/install/style.css";
global $install_wizard_pass; global $install_wizard_pass;
if (x($_POST,'pass')) if (x($_POST,'pass'))
$install_wizard_pass = intval($_POST['pass']); $install_wizard_pass = intval($_POST['pass']);

View File

@ -112,6 +112,7 @@ function network_init(&$a) {
require_once('include/group.php'); require_once('include/group.php');
require_once('include/contact_widgets.php'); require_once('include/contact_widgets.php');
require_once('include/items.php'); require_once('include/items.php');
require_once('include/forums.php');
if(! x($a->page,'aside')) if(! x($a->page,'aside'))
$a->page['aside'] = ''; $a->page['aside'] = '';
@ -145,6 +146,7 @@ function network_init(&$a) {
} }
$a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network',true,$group_id) : ''); $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network',true,$group_id) : '');
$a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist($a) : '');
$a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false); $a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false);
$a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search); $a->page['aside'] .= saved_searches($search);

View File

@ -1,6 +1,8 @@
<?php <?php
/* /**
Documentation: http://nodeinfo.diaspora.software/schema.html * @file mod/nodeinfo.php
*
* Documentation: http://nodeinfo.diaspora.software/schema.html
*/ */
require_once("include/plugin.php"); require_once("include/plugin.php");
@ -67,48 +69,48 @@ function nodeinfo_init(&$a){
$nodeinfo["metadata"] = array("nodeName" => $a->config["sitename"]); $nodeinfo["metadata"] = array("nodeName" => $a->config["sitename"]);
if (nodeinfo_plugin_enabled("appnet")) if (plugin_enabled("appnet"))
$nodeinfo["services"]["inbound"][] = "appnet"; $nodeinfo["services"]["inbound"][] = "appnet";
if (nodeinfo_plugin_enabled("appnet") OR nodeinfo_plugin_enabled("buffer")) if (plugin_enabled("appnet") OR plugin_enabled("buffer"))
$nodeinfo["services"]["outbound"][] = "appnet"; $nodeinfo["services"]["outbound"][] = "appnet";
if (nodeinfo_plugin_enabled("blogger")) if (plugin_enabled("blogger"))
$nodeinfo["services"]["outbound"][] = "blogger"; $nodeinfo["services"]["outbound"][] = "blogger";
if (nodeinfo_plugin_enabled("dwpost")) if (plugin_enabled("dwpost"))
$nodeinfo["services"]["outbound"][] = "dreamwidth"; $nodeinfo["services"]["outbound"][] = "dreamwidth";
if (nodeinfo_plugin_enabled("fbpost") OR nodeinfo_plugin_enabled("buffer")) if (plugin_enabled("fbpost") OR plugin_enabled("buffer"))
$nodeinfo["services"]["outbound"][] = "facebook"; $nodeinfo["services"]["outbound"][] = "facebook";
if (nodeinfo_plugin_enabled("statusnet")) { if (plugin_enabled("statusnet")) {
$nodeinfo["services"]["inbound"][] = "gnusocial"; $nodeinfo["services"]["inbound"][] = "gnusocial";
$nodeinfo["services"]["outbound"][] = "gnusocial"; $nodeinfo["services"]["outbound"][] = "gnusocial";
} }
if (nodeinfo_plugin_enabled("gpluspost") OR nodeinfo_plugin_enabled("buffer")) if (plugin_enabled("gpluspost") OR plugin_enabled("buffer"))
$nodeinfo["services"]["outbound"][] = "google"; $nodeinfo["services"]["outbound"][] = "google";
if (nodeinfo_plugin_enabled("ijpost")) if (plugin_enabled("ijpost"))
$nodeinfo["services"]["outbound"][] = "insanejournal"; $nodeinfo["services"]["outbound"][] = "insanejournal";
if (nodeinfo_plugin_enabled("libertree")) if (plugin_enabled("libertree"))
$nodeinfo["services"]["outbound"][] = "libertree"; $nodeinfo["services"]["outbound"][] = "libertree";
if (nodeinfo_plugin_enabled("buffer")) if (plugin_enabled("buffer"))
$nodeinfo["services"]["outbound"][] = "linkedin"; $nodeinfo["services"]["outbound"][] = "linkedin";
if (nodeinfo_plugin_enabled("ljpost")) if (plugin_enabled("ljpost"))
$nodeinfo["services"]["outbound"][] = "livejournal"; $nodeinfo["services"]["outbound"][] = "livejournal";
if (nodeinfo_plugin_enabled("buffer")) if (plugin_enabled("buffer"))
$nodeinfo["services"]["outbound"][] = "pinterest"; $nodeinfo["services"]["outbound"][] = "pinterest";
if (nodeinfo_plugin_enabled("posterous")) if (plugin_enabled("posterous"))
$nodeinfo["services"]["outbound"][] = "posterous"; $nodeinfo["services"]["outbound"][] = "posterous";
if (nodeinfo_plugin_enabled("pumpio")) { if (plugin_enabled("pumpio")) {
$nodeinfo["services"]["inbound"][] = "pumpio"; $nodeinfo["services"]["inbound"][] = "pumpio";
$nodeinfo["services"]["outbound"][] = "pumpio"; $nodeinfo["services"]["outbound"][] = "pumpio";
} }
@ -118,13 +120,13 @@ function nodeinfo_init(&$a){
if ($smtp) if ($smtp)
$nodeinfo["services"]["outbound"][] = "smtp"; $nodeinfo["services"]["outbound"][] = "smtp";
if (nodeinfo_plugin_enabled("tumblr")) if (plugin_enabled("tumblr"))
$nodeinfo["services"]["outbound"][] = "tumblr"; $nodeinfo["services"]["outbound"][] = "tumblr";
if (nodeinfo_plugin_enabled("twitter") OR nodeinfo_plugin_enabled("buffer")) if (plugin_enabled("twitter") OR plugin_enabled("buffer"))
$nodeinfo["services"]["outbound"][] = "twitter"; $nodeinfo["services"]["outbound"][] = "twitter";
if (nodeinfo_plugin_enabled("wppost")) if (plugin_enabled("wppost"))
$nodeinfo["services"]["outbound"][] = "wordpress"; $nodeinfo["services"]["outbound"][] = "wordpress";
$nodeinfo["metadata"]["protocols"] = $nodeinfo["protocols"]; $nodeinfo["metadata"]["protocols"] = $nodeinfo["protocols"];
@ -134,7 +136,7 @@ function nodeinfo_init(&$a){
$nodeinfo["metadata"]["services"] = $nodeinfo["services"]; $nodeinfo["metadata"]["services"] = $nodeinfo["services"];
if (nodeinfo_plugin_enabled("twitter")) if (plugin_enabled("twitter"))
$nodeinfo["metadata"]["services"]["inbound"][] = "twitter"; $nodeinfo["metadata"]["services"]["inbound"][] = "twitter";
header('Content-type: application/json; charset=utf-8'); header('Content-type: application/json; charset=utf-8');
@ -142,17 +144,14 @@ function nodeinfo_init(&$a){
exit; exit;
} }
function nodeinfo_plugin_enabled($plugin) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin);
return((bool)(count($r) > 0));
}
function nodeinfo_cron() { function nodeinfo_cron() {
$a = get_app(); $a = get_app();
// If the plugin "statistics_json" is enabled then disable it and actrivate nodeinfo. // If the plugin "statistics_json" is enabled then disable it and actrivate nodeinfo.
if (nodeinfo_plugin_enabled("statistics_json")) { if (plugin_enabled("statistics_json")) {
set_config("system", "nodeinfo", true); set_config("system", "nodeinfo", true);
$plugin = "statistics_json"; $plugin = "statistics_json";

View File

@ -41,8 +41,9 @@ function ping_init(&$a) {
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `pitem`.`parent` != 0 `item`.`deleted` = 0 AND `item`.`uid` = %d AND `pitem`.`parent` != 0
AND `item`.`contact-id` != %d
ORDER BY `item`.`created` DESC", ORDER BY `item`.`created` DESC",
intval(local_user()) intval(local_user()), intval(local_user())
); );
if(count($r)) { if(count($r)) {

View File

@ -79,7 +79,7 @@ function profile_photo_post(&$a) {
$im->scaleImage(80); $im->scaleImage(80);
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile); $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
if($r === false) if($r === false)
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL ); notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
@ -97,11 +97,17 @@ function profile_photo_post(&$a) {
dbesc($base_image['resource-id']), dbesc($base_image['resource-id']),
intval(local_user()) intval(local_user())
); );
}
else { $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `self` AND `uid` = %d",
dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-4.' . $im->getExt()),
dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-6.' . $im->getExt()),
intval(local_user())
);
} else {
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d", $r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-4'), dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-4.' . $im->getExt()),
dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-5'), dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
intval($_REQUEST['profile']), intval($_REQUEST['profile']),
intval(local_user()) intval(local_user())
); );

View File

@ -100,6 +100,9 @@ function register_post(&$a) {
). EOL ). EOL
); );
} }
} else {
info( t('Registration successful.') . EOL ) ;
goaway(z_root());
} }
} }
elseif($a->config['register_policy'] == REGISTER_APPROVE) { elseif($a->config['register_policy'] == REGISTER_APPROVE) {

View File

@ -1,5 +1,9 @@
<?php <?php
require_once("mod/nodeinfo.php"); /**
* @file mod/statistics_json.php
*/
require_once("include/plugin.php");
function statistics_json_init(&$a) { function statistics_json_init(&$a) {
@ -20,19 +24,19 @@ function statistics_json_init(&$a) {
); );
$statistics["services"] = array(); $statistics["services"] = array();
$statistics["services"]["appnet"] = nodeinfo_plugin_enabled("appnet"); $statistics["services"]["appnet"] = plugin_enabled("appnet");
$statistics["services"]["blogger"] = nodeinfo_plugin_enabled("blogger"); $statistics["services"]["blogger"] = plugin_enabled("blogger");
$statistics["services"]["buffer"] = nodeinfo_plugin_enabled("buffer"); $statistics["services"]["buffer"] = plugin_enabled("buffer");
$statistics["services"]["dreamwidth"] = nodeinfo_plugin_enabled("dwpost"); $statistics["services"]["dreamwidth"] = plugin_enabled("dwpost");
$statistics["services"]["facebook"] = nodeinfo_plugin_enabled("fbpost"); $statistics["services"]["facebook"] = plugin_enabled("fbpost");
$statistics["services"]["gnusocial"] = nodeinfo_plugin_enabled("statusnet"); $statistics["services"]["gnusocial"] = plugin_enabled("statusnet");
$statistics["services"]["googleplus"] = nodeinfo_plugin_enabled("gpluspost"); $statistics["services"]["googleplus"] = plugin_enabled("gpluspost");
$statistics["services"]["libertree"] = nodeinfo_plugin_enabled("libertree"); $statistics["services"]["libertree"] = plugin_enabled("libertree");
$statistics["services"]["livejournal"] = nodeinfo_plugin_enabled("ljpost"); $statistics["services"]["livejournal"] = plugin_enabled("ljpost");
$statistics["services"]["pumpio"] = nodeinfo_plugin_enabled("pumpio"); $statistics["services"]["pumpio"] = plugin_enabled("pumpio");
$statistics["services"]["twitter"] = nodeinfo_plugin_enabled("twitter"); $statistics["services"]["twitter"] = plugin_enabled("twitter");
$statistics["services"]["tumblr"] = nodeinfo_plugin_enabled("tumblr"); $statistics["services"]["tumblr"] = plugin_enabled("tumblr");
$statistics["services"]["wordpress"] = nodeinfo_plugin_enabled("wppost"); $statistics["services"]["wordpress"] = plugin_enabled("wppost");
$statistics["appnet"] = $statistics["services"]["appnet"]; $statistics["appnet"] = $statistics["services"]["appnet"];
$statistics["blogger"] = $statistics["services"]["blogger"]; $statistics["blogger"] = $statistics["services"]["blogger"];

View File

@ -16,10 +16,10 @@ function wall_upload_post(&$a, $desktopmode = true) {
); );
if(! count($r)){ if(! count($r)){
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.'))); echo json_encode(array('error'=>t('Invalid request.')));
killme(); killme();
} }
return; return;
} }
} else { } else {
@ -29,10 +29,10 @@ function wall_upload_post(&$a, $desktopmode = true) {
); );
} }
} else { } else {
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.'))); echo json_encode(array('error'=>t('Invalid request.')));
killme(); killme();
} }
return; return;
} }
@ -73,18 +73,18 @@ function wall_upload_post(&$a, $desktopmode = true) {
if(! $can_post) { if(! $can_post) {
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>t('Permission denied.'))); echo json_encode(array('error'=>t('Permission denied.')));
killme(); killme();
} }
notice( t('Permission denied.') . EOL ); notice( t('Permission denied.') . EOL );
killme(); killme();
} }
if(! x($_FILES,'userfile') && ! x($_FILES,'media')){ if(! x($_FILES,'userfile') && ! x($_FILES,'media')){
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.'))); echo json_encode(array('error'=>t('Invalid request.')));
} }
killme(); killme();
} }
@ -118,10 +118,10 @@ function wall_upload_post(&$a, $desktopmode = true) {
} }
if ($src=="") { if ($src=="") {
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.'))); echo json_encode(array('error'=>t('Invalid request.')));
killme(); killme();
} }
notice(t('Invalid request.').EOL); notice(t('Invalid request.').EOL);
killme(); killme();
} }
@ -243,9 +243,9 @@ function wall_upload_post(&$a, $desktopmode = true) {
$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash); $r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash);
if (!$r){ if (!$r){
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>'')); echo json_encode(array('error'=>''));
killme(); killme();
} }
return false; return false;
} }
$picture = array(); $picture = array();
@ -260,16 +260,16 @@ function wall_upload_post(&$a, $desktopmode = true) {
$picture["preview"] = $a->get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt(); $picture["preview"] = $a->get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt();
if ($r_json) { if ($r_json) {
echo json_encode(array('picture'=>$picture)); echo json_encode(array('picture'=>$picture));
killme(); killme();
} }
return $picture; return $picture;
} }
if ($r_json) { if ($r_json) {
echo json_encode(array('ok'=>true)); echo json_encode(array('ok'=>true));
killme(); killme();
} }
/* mod Waitman Gobble NO WARRANTY */ /* mod Waitman Gobble NO WARRANTY */

View File

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1190 ); define( 'UPDATE_VERSION' , 1191 );
/** /**
* *
@ -1659,3 +1659,67 @@ function update_1188() {
return UPDATE_SUCCESS; return UPDATE_SUCCESS;
} }
function update_1190() {
require_once('include/plugin.php');
set_config('system', 'maintenance', 1);
if (plugin_enabled('forumlist')) {
$plugin = 'forumlist';
$plugins = get_config('system','addon');
$plugins_arr = array();
if($plugins) {
$plugins_arr = explode(",",str_replace(" ", "",$plugins));
$idx = array_search($plugin, $plugins_arr);
if ($idx !== false){
unset($plugins_arr[$idx]);
//delete forumlist manually from addon and hook table
// since uninstall_plugin() don't work here
q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' ");
set_config('system','addon', implode(", ",$plugins_arr));
}
}
}
// select old formlist addon entries
$r = q("SELECT `uid`, `cat`, `k`, `v` FROM `pconfig` WHERE `cat` = '%s' ",
dbesc('forumlist')
);
// convert old forumlist addon entries in new config entries
if (count($r)) {
foreach ($r as $rr) {
$uid = $rr['uid'];
$family = $rr['cat'];
$key = $rr['k'];
$value = $rr['v'];
if ($key === 'randomise')
del_pconfig($uid,$family,$key);
if ($key === 'show_on_profile') {
if ($value)
set_pconfig($uid,feature,forumlist_profile,$value);
del_pconfig($uid,$family,$key);
}
if ($key === 'show_on_network') {
if ($value)
set_pconfig($uid,feature,forumlist_widget,$value);
del_pconfig($uid,$family,$key);
}
}
}
set_config('system', 'maintenance', 0);
return UPDATE_SUCCESS;
}

View File

@ -260,29 +260,56 @@ a {
} }
/* poke */ /* poke */
#poke-desc { #poke-desc {
margin: 5px 0 10px; margin: 5px 0 10px;
} }
#poke-wrapper { #poke-wrapper {
padding: 10px 0 0px; padding: 10px 0 0px;
} }
#poke-recipient, #poke-action, #poke-privacy-settings { #poke-recipient, #poke-action, #poke-privacy-settings {
margin: 10px 0 30px; margin: 10px 0 30px;
} }
#poke-recip-label, #poke-action-label, #prvmail-message-label { #poke-recip-label, #poke-action-label, #prvmail-message-label {
margin: 10px 0 10px; margin: 10px 0 10px;
} }
ul.credits { ul.credits {
list-style: none; list-style: none;
} }
ul.credits li { ul.credits li {
float: left; float: left;
width: 240px; width: 240px;
} }
.contact-entry-photo img { .contact-entry-photo img {
max-width: 80px; max-width: 80px;
max-height: 80px; max-height: 80px;
} }
/* forumlist widget */
#hide-forum-list {
opacity: 0.3;
filter:alpha(opacity=30);
}
#hide-forum-list:hover {
opacity: 1.0;
filter:alpha(opacity=100);
}
#forumlist-settings-label, #forumlist-random-label, #forumlist-profile-label, #forumlist-network-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#forumlist-max-forumlists, #forumlist-random, #forumlist-profile, #forumlist-network {
float: left;
}
.forumlist-img {
height: 20px;
width: 20px;
}

BIN
view/install/green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

BIN
view/install/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
view/install/red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

58
view/install/style.css Normal file
View File

@ -0,0 +1,58 @@
/***
* Friendica Communcation Server
*
* This is the static css for the install procedure
*/
body {
background-color: #FFF;
max-width: 750px;
margin: 0 auto;
}
section {
background-color: rgb(252, 252, 252);
padding: 0.5em 2em;
}
h1 img {
vertical-align: sub;
}
td {
padding: 0.2em;
border-bottom: 1px solid rgb(238, 238, 238);
}
td.help {
border-width: 0px 0px 2px 2px;
border-style: solid;
border-color: #000;
background: transparent url("/friendica/view/install/info.png") no-repeat scroll 5px 5px;
}
td.help blockquote {
margin-left: 60px;
}
input[type="submit"] {
margin: 2em 0;
}
tt {
background-color: rgb(238, 238, 238);
padding: 0.1em 0.2em;
}
.field {
margin-bottom: 0.5em;
}
.field label,
.field input, .field select, .field textarea {
width: 100%;
display: block;
}
.field .field_help {
color: #999;
text-align: right;
width: 100%;
display: block;
font-size: 0.8em;
}

BIN
view/install/yellow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<h1>{{$title}}</h1> <h1><img src="{{$baseurl}}/images/friendica-32.png"> {{$title}}</h1>
<h2>{{$pass}}</h2> <h2>{{$pass}}</h2>

View File

@ -1,12 +1,22 @@
<h1>{{$title}}</h1> <h1><img src="{{$baseurl}}/images/friendica-32.png"> {{$title}}</h1>
<h2>{{$pass}}</h2> <h2>{{$pass}}</h2>
<form action="{{$baseurl}}/index.php?q=install" method="post"> <form action="{{$baseurl}}/index.php?q=install" method="post">
<table> <table>
{{foreach $checks as $check}} {{foreach $checks as $check}}
<tr><td>{{$check.title}} </td><td><span class="icon s22 {{if $check.status}}on{{else}}{{if $check.required}}off{{else}}yellow{{/if}}{{/if}}"></td><td>{{if $check.required}}(required){{/if}}</td></tr> <tr><td>{{$check.title}} </td><td>
{{if $check.status}}
<img src="{{$baseurl}}/view/install/green.png" alt="Ok">
{{else}}
{{if $check.required}}
<img src="{{$baseurl}}/view/install/red.png" alt="Requirement not satisfied">
{{else}}
<img src="{{$baseurl}}/view/install/yellow.png" alt="Optional requirement not satisfied">
{{/if}}
{{/if}}
</td><td>{{if $check.required}}(required){{/if}}</td></tr>
{{if $check.help}} {{if $check.help}}
<tr><td colspan="3"><blockquote>{{$check.help}}</blockquote></td></tr> <tr><td class="help" colspan="3"><blockquote>{{$check.help}}</blockquote></td></tr>
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}
</table> </table>

View File

@ -1,6 +1,6 @@
<h1>{{$title}}</h1> <h1><img src="{{$baseurl}}/images/friendica-32.png"> {{$title}}</h1>
<h2>{{$pass}}</h2> <h2>{{$pass}}</h2>

View File

@ -1,6 +1,6 @@
<h1>{{$title}}</h1> <h1><img src="{{$baseurl}}/images/friendica-32.png"> {{$title}}</h1>
<h2>{{$pass}}</h2> <h2>{{$pass}}</h2>

View File

@ -167,5 +167,11 @@
{{/if}} {{/if}}
{{if $profile.forumlist}}
<dl id="aprofile-forumlist" class="aprofile">
<dt>{{$profile.forumlist.0}}</dt>
<dd>{{$profile.forumlist.1}}</dd>
</dl>
{{/if}}

View File

@ -0,0 +1,45 @@
<script>
function showHideForumlist() {
if( $("div[id^='forum-widget-entry-extended-']").is(':visible')) {
$("div[id^='forum-widget-entry-extended-']").hide();
$('#forum-widget-collapse').html(window.showMore);
}
else {
$("div[id^='forum-widget-entry-extended-']").show();
$('#forum-widget-collapse').html(window.showFewer);
}
}
</script>
<div id="forumlist-sidebar" class="widget">
<h3 id="forumlist">{{$title}}</h3>
{{foreach $forums as $forum}}
{{if $forum.id <= $visible_forums}}
<div class="forum-widget-entry" id="forum-widget-entry-{{$forum.id}}" role="menuitem">
<a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
<img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
</a>
<a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
</div>
{{/if}}
{{if $forum.id > $visible_forums}}
<div class="forum-widget-entry" id="forum-widget-entry-extended-{{$forum.id}}" role="menuitem" style="display: none;">
<a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
<img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
</a>
<a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
</div>
{{/if}}
{{/foreach}}
{{if $total > $visible_forums }}
<div id="forum-widget-showmore" class="forum-widget-entry" role="menuitem">
<a onclick="showHideForumlist(); return false;" id="forum-widget-collapse" class="forum-widget-link">{{$showmore}}</a>
</div>
{{/if}}
</div>

View File

@ -401,7 +401,7 @@ code {
} }
.sidebar-group-li:hover, #sidebar-new-group:hover, #hide-forum-list:hover, .sidebar-group-li:hover, #sidebar-new-group:hover, #hide-forum-list:hover,
#sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forum-list div:hover, #forum-list-right div:hover, #sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar div:hover, #forum-list-right div:hover,
.nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover { .nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover {
/* background-color: #ddd; */ /* background-color: #ddd; */
/* background-color: #e5e5e5; */ /* background-color: #e5e5e5; */
@ -420,7 +420,7 @@ code {
font-weight: bold; font-weight: bold;
} }
#sidebar-new-group, #hide-forum-list, #forum-list, #forum-list-right, #sidebar-ungrouped, #forum-widget-showmore, #sidebar-new-group, #hide-forum-list, #forum-list-right, #sidebar-ungrouped,
.side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new { .side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new {
padding-left: 10px; padding-left: 10px;
padding-top: 3px; padding-top: 3px;
@ -429,6 +429,17 @@ code {
display: block; display: block;
} }
#forumlist-sidebar {
padding-top: 3px;
padding-bottom: 3px;
display: block;
}
.forum-widget-entry {
padding-left: 10px;
padding-right: 5px;
}
a.nets-link, .side-link a, #sidebar-new-group a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a { a.nets-link, .side-link a, #sidebar-new-group a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a {
display: block; display: block;
color: #737373; color: #737373;
@ -456,11 +467,11 @@ a.sidebar-group-element {
color: black; color: black;
} }
#forum-list a, #forum-list-right a, .tool a, .admin.link a { #forumlist-sidebar a, #forum-list-right a, .tool a, .admin.link a {
color: #737373; color: #737373;
} }
#forum-list, #forum-list-right { #forumlist-sidebar, #forum-list-right {
margin-top: 2px; margin-top: 2px;
} }

View File

@ -9,9 +9,9 @@
* Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/ * Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
*/ */
require_once("mod/nodeinfo.php"); require_once("include/plugin.php");
require_once("mod/proxy.php");
require_once("include/socgraph.php"); require_once("include/socgraph.php");
require_once("mod/proxy.php");
function vier_init(&$a) { function vier_init(&$a) {
@ -33,7 +33,8 @@ function vier_init(&$a) {
$a->page['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n"; $a->page['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n";
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen"/>'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen"/>'."\n";
} }
#$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen and (max-width: 1000px)"/>'."\n"; // deactivated since it doesn't work with desktop browsers at the moment (To-Do)
//$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen and (max-width: 1000px)"/>'."\n";
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<link rel='stylesheet' type='text/css' href='view/theme/vier/narrow.css' media='screen and (max-width: 1100px)' /> <link rel='stylesheet' type='text/css' href='view/theme/vier/narrow.css' media='screen and (max-width: 1100px)' />
@ -305,49 +306,49 @@ function vier_community_info() {
$r = array(); $r = array();
if (nodeinfo_plugin_enabled("appnet")) if (plugin_enabled("appnet"))
$r[] = array("photo" => "images/appnet.png", "name" => "App.net"); $r[] = array("photo" => "images/appnet.png", "name" => "App.net");
if (nodeinfo_plugin_enabled("buffer")) if (plugin_enabled("buffer"))
$r[] = array("photo" => "images/buffer.png", "name" => "Buffer"); $r[] = array("photo" => "images/buffer.png", "name" => "Buffer");
if (nodeinfo_plugin_enabled("blogger")) if (plugin_enabled("blogger"))
$r[] = array("photo" => "images/blogger.png", "name" => "Blogger"); $r[] = array("photo" => "images/blogger.png", "name" => "Blogger");
if (nodeinfo_plugin_enabled("dwpost")) if (plugin_enabled("dwpost"))
$r[] = array("photo" => "images/dreamwidth.png", "name" => "Dreamwidth"); $r[] = array("photo" => "images/dreamwidth.png", "name" => "Dreamwidth");
if (nodeinfo_plugin_enabled("fbpost")) if (plugin_enabled("fbpost"))
$r[] = array("photo" => "images/facebook.png", "name" => "Facebook"); $r[] = array("photo" => "images/facebook.png", "name" => "Facebook");
if (nodeinfo_plugin_enabled("ifttt")) if (plugin_enabled("ifttt"))
$r[] = array("photo" => "addon/ifttt/ifttt.png", "name" => "IFTTT"); $r[] = array("photo" => "addon/ifttt/ifttt.png", "name" => "IFTTT");
if (nodeinfo_plugin_enabled("statusnet")) if (plugin_enabled("statusnet"))
$r[] = array("photo" => "images/gnusocial.png", "name" => "GNU Social"); $r[] = array("photo" => "images/gnusocial.png", "name" => "GNU Social");
if (nodeinfo_plugin_enabled("gpluspost")) if (plugin_enabled("gpluspost"))
$r[] = array("photo" => "images/googleplus.png", "name" => "Google+"); $r[] = array("photo" => "images/googleplus.png", "name" => "Google+");
//if (nodeinfo_plugin_enabled("ijpost")) //if (plugin_enabled("ijpost"))
// $r[] = array("photo" => "images/", "name" => ""); // $r[] = array("photo" => "images/", "name" => "");
if (nodeinfo_plugin_enabled("libertree")) if (plugin_enabled("libertree"))
$r[] = array("photo" => "images/libertree.png", "name" => "Libertree"); $r[] = array("photo" => "images/libertree.png", "name" => "Libertree");
//if (nodeinfo_plugin_enabled("ljpost")) //if (plugin_enabled("ljpost"))
// $r[] = array("photo" => "images/", "name" => ""); // $r[] = array("photo" => "images/", "name" => "");
if (nodeinfo_plugin_enabled("pumpio")) if (plugin_enabled("pumpio"))
$r[] = array("photo" => "images/pumpio.png", "name" => "pump.io"); $r[] = array("photo" => "images/pumpio.png", "name" => "pump.io");
if (nodeinfo_plugin_enabled("tumblr")) if (plugin_enabled("tumblr"))
$r[] = array("photo" => "images/tumblr.png", "name" => "Tumblr"); $r[] = array("photo" => "images/tumblr.png", "name" => "Tumblr");
if (nodeinfo_plugin_enabled("twitter")) if (plugin_enabled("twitter"))
$r[] = array("photo" => "images/twitter.png", "name" => "Twitter"); $r[] = array("photo" => "images/twitter.png", "name" => "Twitter");
if (nodeinfo_plugin_enabled("wppost")) if (plugin_enabled("wppost"))
$r[] = array("photo" => "images/wordpress", "name" => "Wordpress"); $r[] = array("photo" => "images/wordpress", "name" => "Wordpress");
if(function_exists("imap_open") AND !get_config("system","imap_disabled") AND !get_config("system","dfrn_only")) if(function_exists("imap_open") AND !get_config("system","imap_disabled") AND !get_config("system","dfrn_only"))