mirror of
https://github.com/friendica/friendica
synced 2024-12-22 23:20:16 +00:00
forumlist: dbupdate
This commit is contained in:
parent
862ccb95d2
commit
902735f6d4
6 changed files with 65 additions and 17 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.2' );
|
||||
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' );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once("boot.php");
|
||||
require_once("include/text.php");
|
||||
|
||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||
define('NEW_UPDATE_ROUTINE_VERSION', 1191);
|
||||
|
||||
/*
|
||||
* send the email and do what is needed to do on update fails
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
/**
|
||||
* @file include/forums.php
|
||||
* @brief functions related to forum functionality *
|
||||
* @brief Functions related to forum functionality *
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief function to list all forums a user is connected with
|
||||
* @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
|
||||
* Show frorums which are not hidden
|
||||
* @param boolean $lastitem
|
||||
* sort by lastitem
|
||||
* Sort by lastitem
|
||||
* @param boolean $showprivate
|
||||
* show private groups
|
||||
* Show private groups
|
||||
*
|
||||
* @returns array
|
||||
* 'url' => forum url
|
||||
|
@ -27,11 +27,11 @@ function get_forumlist($uid, $showhidden = true, $lastitem, $showprivate = false
|
|||
|
||||
$forumlist = array();
|
||||
|
||||
$order = (($showhidden) ? '' : " AND `hidden` = 0 ");
|
||||
$order = (($showhidden) ? '' : ' AND `hidden` = 0 ');
|
||||
$order .= (($lastitem) ? ' ORDER BY `last-item` ASC ' : ' ORDER BY `name` ASC ');
|
||||
$select = "`forum` = 1";
|
||||
$select = '`forum` = 1';
|
||||
if ($showprivate) {
|
||||
$select = "( `forum` = 1 OR `prv` = 1 )";
|
||||
$select = '( `forum` = 1 OR `prv` = 1 )';
|
||||
}
|
||||
|
||||
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro` FROM contact
|
||||
|
@ -54,7 +54,7 @@ function get_forumlist($uid, $showhidden = true, $lastitem, $showprivate = false
|
|||
|
||||
|
||||
/**
|
||||
* @brief forumlist widget
|
||||
* @brief Forumlist widget
|
||||
*
|
||||
* Sidebar widget to show subcribed friendica forums. If activated
|
||||
* in the settings, it appears at the notwork page sidebar
|
||||
|
@ -95,7 +95,7 @@ function widget_forumlist($a) {
|
|||
$tpl = get_markup_template('widget_forumlist.tpl');
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$title' => t("Forums"),
|
||||
'$title' => t('Forums'),
|
||||
'$forums' => $entries,
|
||||
'$link_desc' => t('External link to forum'),
|
||||
'$total' => $total,
|
||||
|
@ -108,7 +108,7 @@ function widget_forumlist($a) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief format forumlist as contact block
|
||||
* @brief Format forumlist as contact block
|
||||
*
|
||||
* This function is used to show the forumlist in
|
||||
* the advanced profile.
|
||||
|
@ -145,4 +145,4 @@ function forumlist_profile_advanced($uid) {
|
|||
if(count($contacts) > 0)
|
||||
$o .= $forumlist;
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
|
50
update.php
50
update.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1190 );
|
||||
define( 'UPDATE_VERSION' , 1191 );
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1659,3 +1659,51 @@ function update_1188() {
|
|||
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
||||
function update_1190() {
|
||||
|
||||
require_once('/include/plugins.php');
|
||||
|
||||
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]);
|
||||
uninstall_plugin($plugin);
|
||||
set_config('system','addon', implode(', ',$plugins_arr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$r = q("SELECT `uid`, `cat`, `k`, `v` FROM `pconfig` WHERE `cat` = '%d' ",
|
||||
dbesc('forumlist')
|
||||
);
|
||||
|
||||
foreach ($r as $rr) {
|
||||
$uid = $rr['uid'];
|
||||
$family = $rr['cat'];
|
||||
$key = $rr['k'];
|
||||
$value = $rr['v'];
|
||||
|
||||
if ($key === 'randomize')
|
||||
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,$value);
|
||||
|
||||
del_pconfig($uid,$family,$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -312,4 +312,4 @@ ul.credits li {
|
|||
.forumlist-img {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,4 +42,4 @@ function showHideForumlist() {
|
|||
</ul>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue