]> git.mxchange.org Git - friendica.git/blobdiff - include/group.php
work in progress js_uploader plugin, turn java uploader into plugin - not done yet
[friendica.git] / include / group.php
index f2e3d18203b570266cc70edaaba32f7350d65942..793e854be046bc7f43db7572b249621e2dc19e8d 100644 (file)
@@ -38,7 +38,7 @@ function group_rmv($uid,$name) {
                );
 
                // remove group
-               $r = q("DELETE FROM `group` WHERE `uid` = %d AND `id` = %d LIMIT 1",
+               $r = q("UPDATE `group` SET `deleted` = 1 WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
                        intval($uid),
                        dbesc($name)
                );
@@ -46,7 +46,6 @@ function group_rmv($uid,$name) {
                $ret = $r;
 
        }
-       // TODO!! remove this group from all content ACL's !!
 
        return $ret;
 }
@@ -121,31 +120,37 @@ function group_get_members($gid) {
 
 
 
-function group_side() {
+function group_side($every="contacts",$each="group") {
+
+       $o = '';
 
        if(! local_user())
-               return;
+               return '';
+
+       $createtext = t('Create a new group');
+       $linktext= t('Everybody');
+
 $o .= <<< EOT
 
 <div id="group-sidebar">
 <h3>Groups</h3>
 
 <div id="sidebar-new-group">
-<a href="group/new">Create a new group</a>
+<a href="group/new">$createtext</a>
 </div>
 
 <div id="sidebar-group-list">
        <ul id="sidebar-group-ul">
-       <li class="sidebar-group-li" ><a href="contacts">Everybody</a></li>
+       <li class="sidebar-group-li" ><a href="$every" >$linktext</a></li>
 
 EOT;
 
-       $r = q("SELECT * FROM `group` WHERE `uid` = %d",
+       $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d",
                intval($_SESSION['uid'])
        );
        if(count($r)) {
                foreach($r as $rr)
-                       $o .= " <li class=\"sidebar-group-li\"><a href=\"group/{$rr['id']}\">{$rr['name']}</a></li>\r\n";
+                       $o .= " <li class=\"sidebar-group-li\"><a href=\"$each/{$rr['id']}\">{$rr['name']}</a></li>\r\n";
        }
        $o .= " </ul>\r\n       </div>\r\n</div>";