mirror of
https://github.com/friendica/friendica
synced 2024-12-23 12:40:17 +00:00
Merge pull request #2061 from rabuzarus/0711_forumlist
move forumlist addon to core
This commit is contained in:
commit
e43c7a4447
13 changed files with 524 additions and 112 deletions
2
boot.php
2
boot.php
|
@ -19,7 +19,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
|||
define ( 'FRIENDICA_CODENAME', 'Lily of the valley');
|
||||
define ( 'FRIENDICA_VERSION', '3.4.3-dev' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1190 );
|
||||
define ( 'DB_UPDATE_VERSION', 1191 );
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
||||
|
|
|
@ -1,19 +1,54 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Features management
|
||||
/**
|
||||
* @file include/features.php *
|
||||
* @brief Features management
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief check if feature is enabled
|
||||
*
|
||||
* return boolean
|
||||
*/
|
||||
function feature_enabled($uid,$feature) {
|
||||
//return true;
|
||||
|
||||
$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);
|
||||
call_hooks('feature_enabled',$arr);
|
||||
return($arr['enabled']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if feature is enabled or disabled by default
|
||||
*
|
||||
* @param string $feature
|
||||
* @return boolean
|
||||
*/
|
||||
function get_feature_default($feature) {
|
||||
$f = get_features();
|
||||
foreach($f as $cat) {
|
||||
foreach($cat as $feat) {
|
||||
if(is_array($feat) && $feat[0] === $feature)
|
||||
return $feat[3];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ brief get a list of all available features
|
||||
* The array includes the setting group, the setting name,
|
||||
* explainations for the setting and if it's enabled or disabled
|
||||
* by default
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_features() {
|
||||
|
||||
$arr = array(
|
||||
|
@ -22,46 +57,53 @@ function get_features() {
|
|||
'general' => array(
|
||||
t('General Features'),
|
||||
//array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
|
||||
array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')),
|
||||
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),
|
||||
),
|
||||
|
||||
// Post composition
|
||||
'composition' => array(
|
||||
t('Post Composition Features'),
|
||||
array('richtext', t('Richtext Editor'), t('Enable richtext editor')),
|
||||
array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')),
|
||||
array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a fourm page is selected/deselected in ACL window.')),
|
||||
array('richtext', t('Richtext Editor'), t('Enable richtext editor'),false),
|
||||
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.'),false),
|
||||
),
|
||||
|
||||
// Network sidebar widgets
|
||||
'widgets' => array(
|
||||
t('Network Sidebar Widgets'),
|
||||
array('archives', t('Search by Date'), t('Ability to select posts by date ranges')),
|
||||
array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group')),
|
||||
array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network')),
|
||||
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
|
||||
array('archives', t('Search by Date'), t('Ability to select posts by date ranges'),false),
|
||||
array('forumlist_widget', t('List Forums'), t('Enable widget to display the forums your are connected with'),true),
|
||||
array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group'),false),
|
||||
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
|
||||
'net_tabs' => array(
|
||||
t('Network Tabs'),
|
||||
array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')),
|
||||
array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)')),
|
||||
array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them')),
|
||||
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)'),false),
|
||||
array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them'),false),
|
||||
),
|
||||
|
||||
// Item tools
|
||||
'tools' => array(
|
||||
t('Post/Comment Tools'),
|
||||
array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')),
|
||||
array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')),
|
||||
array('commtag', t('Tagging'), t('Ability to tag existing posts')),
|
||||
array('categories', t('Post Categories'), t('Add categories to your posts')),
|
||||
array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
|
||||
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'),false),
|
||||
array('commtag', t('Tagging'), t('Ability to tag existing posts'),false),
|
||||
array('categories', t('Post Categories'), t('Add categories to your posts'),false),
|
||||
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('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
|
||||
array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread')),
|
||||
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'),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),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
148
include/forums.php
Normal file
148
include/forums.php
Normal file
|
@ -0,0 +1,148 @@
|
|||
<?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 `hidden` = 0 ');
|
||||
$order .= (($lastitem) ? ' ORDER BY `last-item` ASC ' : ' ORDER BY `name` ASC ');
|
||||
$select = '`forum` = 1';
|
||||
if ($showprivate) {
|
||||
$select = '( `forum` = 1 OR `prv` = 1 )';
|
||||
}
|
||||
|
||||
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro` FROM contact
|
||||
WHERE `network`= 'dfrn' AND $select AND `uid` = %d
|
||||
AND `blocked` = 0 AND `hidden` = 0 AND `pending` = 0 AND `archive` = 0
|
||||
$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;
|
||||
}
|
|
@ -1,4 +1,9 @@
|
|||
<?php
|
||||
/**
|
||||
* @file include/identity.php
|
||||
*/
|
||||
|
||||
require_once('include/forums.php');
|
||||
|
||||
|
||||
/**
|
||||
|
@ -59,15 +64,15 @@ if(! function_exists('profile_load')) {
|
|||
$profile_int = intval($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`
|
||||
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),
|
||||
intval($profile_int)
|
||||
);
|
||||
}
|
||||
if((!$r) && (!count($r))) {
|
||||
$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`
|
||||
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1",
|
||||
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",
|
||||
dbesc($nickname)
|
||||
);
|
||||
}
|
||||
|
@ -82,7 +87,7 @@ if(! function_exists('profile_load')) {
|
|||
// fetch user tags if this isn't the default profile
|
||||
|
||||
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'])
|
||||
);
|
||||
if($x && count($x))
|
||||
|
@ -306,7 +311,7 @@ if(! function_exists('profile_sidebar')) {
|
|||
if(count($r))
|
||||
$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', '')",
|
||||
intval($profile['uid']),
|
||||
dbesc(NETWORK_DFRN),
|
||||
|
@ -525,8 +530,9 @@ if(! function_exists('get_events')) {
|
|||
function advanced_profile(&$a) {
|
||||
|
||||
$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')
|
||||
));
|
||||
|
||||
|
@ -604,6 +610,11 @@ function advanced_profile(&$a) {
|
|||
|
||||
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())
|
||||
$profile['edit'] = array($a->get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile'));
|
||||
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
<?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')){
|
||||
function uninstall_plugin($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')){
|
||||
function install_plugin($plugin) {
|
||||
// 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.
|
||||
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
@ -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')) {
|
||||
function register_hook($hook,$file,$function,$priority=0) {
|
||||
|
||||
|
@ -129,6 +162,14 @@ function register_hook($hook,$file,$function,$priority=0) {
|
|||
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')) {
|
||||
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')) {
|
||||
function call_hooks($name, &$data = null) {
|
||||
$stamp1 = microtime(true);
|
||||
|
@ -178,7 +227,7 @@ function call_hooks($name, &$data = null) {
|
|||
}
|
||||
else {
|
||||
// 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($hook[0]),
|
||||
dbesc($hook[1])
|
||||
|
@ -204,16 +253,20 @@ function plugin_is_app($name) {
|
|||
return false;
|
||||
}}
|
||||
|
||||
/*
|
||||
* parse plugin comment in search of plugin infos.
|
||||
* like
|
||||
/**
|
||||
* @brief Parse plugin comment in search of plugin infos.
|
||||
*
|
||||
* * Name: Plugin
|
||||
* like
|
||||
* \code
|
||||
*...* Name: Plugin
|
||||
* * Description: A plugin which plugs in
|
||||
* * Version: 1.2.3
|
||||
* . * Version: 1.2.3
|
||||
* * Author: John <profile url>
|
||||
* * Author: Jane <email>
|
||||
* *
|
||||
* *\endcode
|
||||
* @param string $plugin the name of the plugin
|
||||
* @return array with the plugin information
|
||||
*/
|
||||
|
||||
if (! function_exists('get_plugin_info')){
|
||||
|
@ -265,16 +318,20 @@ function get_plugin_info($plugin){
|
|||
}}
|
||||
|
||||
|
||||
/*
|
||||
* parse theme comment in search of theme infos.
|
||||
* like
|
||||
/**
|
||||
* @brief Parse theme comment in search of theme infos.
|
||||
*
|
||||
* * Name: My Theme
|
||||
* like
|
||||
* \code
|
||||
* ..* Name: My Theme
|
||||
* * Description: My Cool Theme
|
||||
* * Version: 1.2.3
|
||||
* . * Version: 1.2.3
|
||||
* * Author: John <profile url>
|
||||
* * Maintainer: Jane <profile url>
|
||||
* *
|
||||
* \endcode
|
||||
* @param string $theme the name of the theme
|
||||
* @return array
|
||||
*/
|
||||
|
||||
if (! function_exists('get_theme_info')){
|
||||
|
@ -340,7 +397,14 @@ function get_theme_info($theme){
|
|||
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) {
|
||||
$a = get_app();
|
||||
$exts = array('.png','.jpg');
|
||||
|
@ -402,7 +466,7 @@ function service_class_allows($uid,$property,$usage = false) {
|
|||
$service_class = $a->user['service_class'];
|
||||
}
|
||||
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)
|
||||
);
|
||||
if($r !== false and count($r)) {
|
||||
|
@ -432,7 +496,7 @@ function service_class_fetch($uid,$property) {
|
|||
$service_class = $a->user['service_class'];
|
||||
}
|
||||
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)
|
||||
);
|
||||
if($r !== false and count($r)) {
|
||||
|
|
|
@ -112,6 +112,7 @@ function network_init(&$a) {
|
|||
require_once('include/group.php');
|
||||
require_once('include/contact_widgets.php');
|
||||
require_once('include/items.php');
|
||||
require_once('include/forums.php');
|
||||
|
||||
if(! x($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(),'forumlist_widget') ? widget_forumlist($a) : '');
|
||||
$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'] .= saved_searches($search);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
/*
|
||||
Documentation: http://nodeinfo.diaspora.software/schema.html
|
||||
/**
|
||||
* @file mod/nodeinfo.php
|
||||
*
|
||||
* Documentation: http://nodeinfo.diaspora.software/schema.html
|
||||
*/
|
||||
|
||||
require_once("include/plugin.php");
|
||||
|
@ -67,48 +69,48 @@ function nodeinfo_init(&$a){
|
|||
|
||||
$nodeinfo["metadata"] = array("nodeName" => $a->config["sitename"]);
|
||||
|
||||
if (nodeinfo_plugin_enabled("appnet"))
|
||||
if (plugin_enabled("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";
|
||||
|
||||
if (nodeinfo_plugin_enabled("blogger"))
|
||||
if (plugin_enabled("blogger"))
|
||||
$nodeinfo["services"]["outbound"][] = "blogger";
|
||||
|
||||
if (nodeinfo_plugin_enabled("dwpost"))
|
||||
if (plugin_enabled("dwpost"))
|
||||
$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";
|
||||
|
||||
if (nodeinfo_plugin_enabled("statusnet")) {
|
||||
if (plugin_enabled("statusnet")) {
|
||||
$nodeinfo["services"]["inbound"][] = "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";
|
||||
|
||||
if (nodeinfo_plugin_enabled("ijpost"))
|
||||
if (plugin_enabled("ijpost"))
|
||||
$nodeinfo["services"]["outbound"][] = "insanejournal";
|
||||
|
||||
if (nodeinfo_plugin_enabled("libertree"))
|
||||
if (plugin_enabled("libertree"))
|
||||
$nodeinfo["services"]["outbound"][] = "libertree";
|
||||
|
||||
if (nodeinfo_plugin_enabled("buffer"))
|
||||
if (plugin_enabled("buffer"))
|
||||
$nodeinfo["services"]["outbound"][] = "linkedin";
|
||||
|
||||
if (nodeinfo_plugin_enabled("ljpost"))
|
||||
if (plugin_enabled("ljpost"))
|
||||
$nodeinfo["services"]["outbound"][] = "livejournal";
|
||||
|
||||
if (nodeinfo_plugin_enabled("buffer"))
|
||||
if (plugin_enabled("buffer"))
|
||||
$nodeinfo["services"]["outbound"][] = "pinterest";
|
||||
|
||||
if (nodeinfo_plugin_enabled("posterous"))
|
||||
if (plugin_enabled("posterous"))
|
||||
$nodeinfo["services"]["outbound"][] = "posterous";
|
||||
|
||||
if (nodeinfo_plugin_enabled("pumpio")) {
|
||||
if (plugin_enabled("pumpio")) {
|
||||
$nodeinfo["services"]["inbound"][] = "pumpio";
|
||||
$nodeinfo["services"]["outbound"][] = "pumpio";
|
||||
}
|
||||
|
@ -118,13 +120,13 @@ function nodeinfo_init(&$a){
|
|||
if ($smtp)
|
||||
$nodeinfo["services"]["outbound"][] = "smtp";
|
||||
|
||||
if (nodeinfo_plugin_enabled("tumblr"))
|
||||
if (plugin_enabled("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";
|
||||
|
||||
if (nodeinfo_plugin_enabled("wppost"))
|
||||
if (plugin_enabled("wppost"))
|
||||
$nodeinfo["services"]["outbound"][] = "wordpress";
|
||||
|
||||
$nodeinfo["metadata"]["protocols"] = $nodeinfo["protocols"];
|
||||
|
@ -134,7 +136,7 @@ function nodeinfo_init(&$a){
|
|||
|
||||
$nodeinfo["metadata"]["services"] = $nodeinfo["services"];
|
||||
|
||||
if (nodeinfo_plugin_enabled("twitter"))
|
||||
if (plugin_enabled("twitter"))
|
||||
$nodeinfo["metadata"]["services"]["inbound"][] = "twitter";
|
||||
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
|
@ -142,17 +144,14 @@ function nodeinfo_init(&$a){
|
|||
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() {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
// 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);
|
||||
|
||||
$plugin = "statistics_json";
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
require_once("mod/nodeinfo.php");
|
||||
/**
|
||||
* @file mod/statistics_json.php
|
||||
*/
|
||||
|
||||
require_once("include/plugin.php");
|
||||
|
||||
function statistics_json_init(&$a) {
|
||||
|
||||
|
@ -20,19 +24,19 @@ function statistics_json_init(&$a) {
|
|||
);
|
||||
|
||||
$statistics["services"] = array();
|
||||
$statistics["services"]["appnet"] = nodeinfo_plugin_enabled("appnet");
|
||||
$statistics["services"]["blogger"] = nodeinfo_plugin_enabled("blogger");
|
||||
$statistics["services"]["buffer"] = nodeinfo_plugin_enabled("buffer");
|
||||
$statistics["services"]["dreamwidth"] = nodeinfo_plugin_enabled("dwpost");
|
||||
$statistics["services"]["facebook"] = nodeinfo_plugin_enabled("fbpost");
|
||||
$statistics["services"]["gnusocial"] = nodeinfo_plugin_enabled("statusnet");
|
||||
$statistics["services"]["googleplus"] = nodeinfo_plugin_enabled("gpluspost");
|
||||
$statistics["services"]["libertree"] = nodeinfo_plugin_enabled("libertree");
|
||||
$statistics["services"]["livejournal"] = nodeinfo_plugin_enabled("ljpost");
|
||||
$statistics["services"]["pumpio"] = nodeinfo_plugin_enabled("pumpio");
|
||||
$statistics["services"]["twitter"] = nodeinfo_plugin_enabled("twitter");
|
||||
$statistics["services"]["tumblr"] = nodeinfo_plugin_enabled("tumblr");
|
||||
$statistics["services"]["wordpress"] = nodeinfo_plugin_enabled("wppost");
|
||||
$statistics["services"]["appnet"] = plugin_enabled("appnet");
|
||||
$statistics["services"]["blogger"] = plugin_enabled("blogger");
|
||||
$statistics["services"]["buffer"] = plugin_enabled("buffer");
|
||||
$statistics["services"]["dreamwidth"] = plugin_enabled("dwpost");
|
||||
$statistics["services"]["facebook"] = plugin_enabled("fbpost");
|
||||
$statistics["services"]["gnusocial"] = plugin_enabled("statusnet");
|
||||
$statistics["services"]["googleplus"] = plugin_enabled("gpluspost");
|
||||
$statistics["services"]["libertree"] = plugin_enabled("libertree");
|
||||
$statistics["services"]["livejournal"] = plugin_enabled("ljpost");
|
||||
$statistics["services"]["pumpio"] = plugin_enabled("pumpio");
|
||||
$statistics["services"]["twitter"] = plugin_enabled("twitter");
|
||||
$statistics["services"]["tumblr"] = plugin_enabled("tumblr");
|
||||
$statistics["services"]["wordpress"] = plugin_enabled("wppost");
|
||||
|
||||
$statistics["appnet"] = $statistics["services"]["appnet"];
|
||||
$statistics["blogger"] = $statistics["services"]["blogger"];
|
||||
|
|
66
update.php
66
update.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1190 );
|
||||
define( 'UPDATE_VERSION' , 1191 );
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1659,3 +1659,67 @@ function update_1188() {
|
|||
|
||||
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;
|
||||
|
||||
}
|
||||
|
|
|
@ -286,3 +286,30 @@ ul.credits li {
|
|||
max-width: 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;
|
||||
}
|
||||
|
|
|
@ -167,5 +167,11 @@
|
|||
{{/if}}
|
||||
|
||||
|
||||
{{if $profile.forumlist}}
|
||||
<dl id="aprofile-forumlist" class="aprofile">
|
||||
<dt>{{$profile.forumlist.0}}</dt>
|
||||
<dd>{{$profile.forumlist.1}}</dd>
|
||||
</dl>
|
||||
{{/if}}
|
||||
|
||||
|
||||
|
|
45
view/templates/widget_forumlist.tpl
Normal file
45
view/templates/widget_forumlist.tpl
Normal file
|
@ -0,0 +1,45 @@
|
|||
<script>
|
||||
|
||||
function showHideForumlist() {
|
||||
if( $('#forum-widget-entry-extended').is(':visible')) {
|
||||
$('#forum-widget-entry-extended').hide();
|
||||
$('#forum-widget-collapse').html(window.showMore);
|
||||
|
||||
}
|
||||
else {
|
||||
$('#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" 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" 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 }}
|
||||
<ul class="forum-widget-ul">
|
||||
<li onclick="showHideForumlist(); return false;" id="forum-widget-collapse" class="fakelink tool">{{$showmore}}</li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
|
@ -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/
|
||||
*/
|
||||
|
||||
require_once("mod/nodeinfo.php");
|
||||
require_once("mod/proxy.php");
|
||||
require_once("include/plugin.php");
|
||||
require_once("include/socgraph.php");
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
function vier_init(&$a) {
|
||||
|
||||
|
@ -305,49 +305,49 @@ function vier_community_info() {
|
|||
|
||||
$r = array();
|
||||
|
||||
if (nodeinfo_plugin_enabled("appnet"))
|
||||
if (plugin_enabled("appnet"))
|
||||
$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");
|
||||
|
||||
if (nodeinfo_plugin_enabled("blogger"))
|
||||
if (plugin_enabled("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");
|
||||
|
||||
if (nodeinfo_plugin_enabled("fbpost"))
|
||||
if (plugin_enabled("fbpost"))
|
||||
$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");
|
||||
|
||||
if (nodeinfo_plugin_enabled("statusnet"))
|
||||
if (plugin_enabled("statusnet"))
|
||||
$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+");
|
||||
|
||||
//if (nodeinfo_plugin_enabled("ijpost"))
|
||||
//if (plugin_enabled("ijpost"))
|
||||
// $r[] = array("photo" => "images/", "name" => "");
|
||||
|
||||
if (nodeinfo_plugin_enabled("libertree"))
|
||||
if (plugin_enabled("libertree"))
|
||||
$r[] = array("photo" => "images/libertree.png", "name" => "Libertree");
|
||||
|
||||
//if (nodeinfo_plugin_enabled("ljpost"))
|
||||
//if (plugin_enabled("ljpost"))
|
||||
// $r[] = array("photo" => "images/", "name" => "");
|
||||
|
||||
if (nodeinfo_plugin_enabled("pumpio"))
|
||||
if (plugin_enabled("pumpio"))
|
||||
$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");
|
||||
|
||||
if (nodeinfo_plugin_enabled("twitter"))
|
||||
if (plugin_enabled("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");
|
||||
|
||||
if(function_exists("imap_open") AND !get_config("system","imap_disabled") AND !get_config("system","dfrn_only"))
|
||||
|
|
Loading…
Reference in a new issue