use Friendica\BaseModule;
use Friendica\BaseObject;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Util\Security;
-require_once 'boot.php';
-require_once 'include/dba.php';
-require_once 'include/text.php';
-
/**
* @brief functions for interacting with the group database table
*/
public static function create($uid, $name)
{
$return = false;
- if (x($uid) && x($name)) {
+ if (!empty($uid) && !empty($name)) {
$gid = self::getIdByName($uid, $name); // check for dupes
if ($gid !== false) {
// This could be a problem.
*/
public static function removeByName($uid, $name) {
$return = false;
- if (x($uid) && x($name)) {
+ if (!empty($uid) && !empty($name)) {
$gid = self::getIdByName($uid, $name);
$return = self::remove($gid);
'selected' => $gid == $group['id'] ? 'true' : ''
];
}
- logger('groups: ' . print_r($display_groups, true));
+ Logger::log('groups: ' . print_r($display_groups, true));
if ($label == '') {
$label = L10n::t('Default privacy group for new contacts');
}
- $o = replace_macros(get_markup_template('group_selection.tpl'), [
+ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('group_selection.tpl'), [
'$label' => $label,
'$groups' => $display_groups
]);
];
}
- $tpl = get_markup_template('group_side.tpl');
- $o = replace_macros($tpl, [
+ // Don't show the groups on the network page when there is only one
+ if ((count($display_groups) <= 2) && ($each == 'network')) {
+ return '';
+ }
+
+ $tpl = Renderer::getMarkupTemplate('group_side.tpl');
+ $o = Renderer::replaceMacros($tpl, [
'$add' => L10n::t('add'),
'$title' => L10n::t('Groups'),
'$groups' => $display_groups,