diff options
author | fabrixxm <fabrix.xm@gmail.com> | 2011-11-21 04:57:56 -0800 |
---|---|---|
committer | fabrixxm <fabrix.xm@gmail.com> | 2011-11-21 04:57:56 -0800 |
commit | ea04263f52dc30ca21e2bfb61ff41cf4428f69f2 (patch) | |
tree | 9234db8ab0c946ed65123181acba0df71524a8eb /include | |
parent | aaedac8f574278fba89cd11d3d8f1adaeb6b030e (diff) | |
parent | cb05e677a96e1312263c0a1c63ee10cea62268b1 (diff) | |
download | volse-hubzilla-ea04263f52dc30ca21e2bfb61ff41cf4428f69f2.tar.gz volse-hubzilla-ea04263f52dc30ca21e2bfb61ff41cf4428f69f2.tar.bz2 volse-hubzilla-ea04263f52dc30ca21e2bfb61ff41cf4428f69f2.zip |
Merge pull request #8 from fabrixxm/master
expire settings, clean html from php, more work on quattro
Diffstat (limited to 'include')
-rw-r--r-- | include/group.php | 66 | ||||
-rw-r--r-- | include/items.php | 19 |
2 files changed, 54 insertions, 31 deletions
diff --git a/include/group.php b/include/group.php index 084cddcac..cae76eb6d 100644 --- a/include/group.php +++ b/include/group.php @@ -162,23 +162,20 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 if(! local_user()) return ''; - $createtext = t('Create a new group'); - $linktext= t('Everybody'); - $selected = (($group_id == 0) ? ' group-selected' : ''); -$o .= <<< EOT - -<div id="group-sidebar" class="widget"> -<h3>Groups</h3> + $groups = array(); + + $groups[] = array( + 'text' => t('Everybody'), + 'selected' => (($group_id == 0) ? 'group-selected' : ''), + 'href' => $every, + ); -<div id="sidebar-group-list"> - <ul id="sidebar-group-ul"> - <li class="sidebar-group-li" ><a href="$every" class="sidebar-group-element$selected" >$linktext</a></li> -EOT; $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC", intval($_SESSION['uid']) ); + $member_of = array(); if($cid) { $member_of = groups_containing(local_user(),$cid); } @@ -186,25 +183,38 @@ EOT; if(count($r)) { foreach($r as $rr) { $selected = (($group_id == $rr['id']) ? ' group-selected' : ''); - $o .= ' <li class="sidebar-group-li">' - . (($edit) ? "<a href=\"group/{$rr['id']}\" title=\"" . t('Edit') - . "\" class=\"groupsideedit\" ><span class=\"icon small-pencil\"></span></a> " : "") - . (($cid) ? '<input type="checkbox" class="' . (($selected) ? 'ticked' : 'unticked') . '" onclick="contactgroupChangeMember(' . $rr['id'] . ',' . $cid . ');return true;" ' - . ((in_array($rr['id'],$member_of)) ? ' checked="checked" ' : '') . '/>' : '') - . "<a href=\"$each/{$rr['id']}\" class=\"sidebar-group-element" . $selected ."\" >{$rr['name']}</a></li>\r\n"; + + if ($edit) { + $groupedit = array( + 'href' => "group/".$rr['id'], + 'title' => t('edit'), + ); + } else { + $groupedit = null; + } + + $groups[] = array( + 'id' => $rr['id'], + 'cid' => $cid, + 'text' => $rr['name'], + 'selected' => $selected, + 'href' => $each."/".$rr['id'], + 'edit' => $groupedit, + 'ismember' => in_array($rr['id'],$member_of), + ); } } - $o .= " </ul>\r\n </div>"; - - $o .= <<< EOT - - <div id="sidebar-new-group"> - <a href="group/new">$createtext</a> - </div> -</div> -EOT; - + + $tpl = get_markup_template("group_side.tpl"); + $o = replace_macros($tpl, array( + '$title' => t('Groups'), + '$createtext' => t('Create a new group'), + '$groups' => $groups, + '$add' => t('add'), + )); + + return $o; } @@ -246,4 +256,4 @@ function groups_containing($uid,$c) { } return $ret; -}
\ No newline at end of file +} diff --git a/include/items.php b/include/items.php index 4e5617627..fd36dcadb 100644 --- a/include/items.php +++ b/include/items.php @@ -2814,14 +2814,27 @@ function item_expire($uid,$days) { if(! count($r)) return; + + $expire_items = get_pconfig($uid, 'expire','items'); + $expire_items = (($expire_items===false)?1:intval($expire_items)); // default if not set: 1 + + $expire_notes = get_pconfig($uid, 'expire','notes'); + $expire_notes = (($expire_notes===false)?1:intval($expire_notes)); // default if not set: 1 + + $expire_photos = get_pconfig($uid, 'expire','photos'); + $expire_photos = (($expire_photos===false)?0:intval($expire_photos)); // default if not set: 0 - logger('expire: # items=' . count($r) ); + logger('expire: # items=' . count($r). "; expire items: $expire_items, expire notes: $expire_notes, expire photos: $expire_photos"); foreach($r as $item) { // Only expire posts, not photos and photo comments - if(strlen($item['resource-id'])) + if($expire_photos==0 && strlen($item['resource-id'])) + continue; + if($expire_notes==0 && $item['type']=='note') + continue; + if($expire_items==0 && $item['type']!='note') continue; $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1", @@ -2842,7 +2855,7 @@ function item_expire($uid,$days) { } proc_run('php',"include/notifier.php","expire","$uid"); - + } |