aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/group.php66
-rw-r--r--include/items.php19
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");
-
+
}