aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/connedit.php33
-rw-r--r--mod/poco.php3
-rw-r--r--mod/prep.php38
3 files changed, 72 insertions, 2 deletions
diff --git a/mod/connedit.php b/mod/connedit.php
index 5c36c3184..c27f4588a 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -107,6 +107,14 @@ function connedit_post(&$a) {
if($closeness < 0)
$closeness = 99;
+ $rating = intval($_POST['rating']);
+ if($rating < (-10))
+ $rating = (-10);
+ if($rating > 10)
+ $rating = 10;
+
+ $rating_text = escape_tags($_REQUEST['rating_text']);
+
$abook_my_perms = 0;
foreach($_POST as $k => $v) {
@@ -125,11 +133,13 @@ function connedit_post(&$a) {
$new_friend = true;
}
- $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d
+ $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_rating = %d, abook_rating_text = '%s', abook_flags = %d
where abook_id = %d AND abook_channel = %d",
dbesc($profile_id),
intval($abook_my_perms),
intval($closeness),
+ intval($rating),
+ dbesc($rating_text),
intval($abook_flags),
intval($contact_id),
intval(local_user())
@@ -524,6 +534,22 @@ function connedit_content(&$a) {
));
}
+ $poco_rating = get_config('system','poco_rating_enable');
+ // if unset default to enabled
+ if($poco_rating === false)
+ $poco_rating = true;
+
+ if($poco_rating) {
+ $rating = replace_macros(get_markup_template('rating_slider.tpl'),array(
+ '$min' => -10,
+ '$val' => (($contact['abook_rating']) ? $contact['abook_rating'] : 0),
+ ));
+ }
+ else {
+ $rating = false;
+ }
+
+
$perms = array();
$channel = $a->get_channel();
@@ -555,6 +581,11 @@ function connedit_content(&$a) {
'$buttons' => (($self) ? '' : $buttons),
'$viewprof' => t('View Profile'),
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
+ '$lbl_rating' => t('Rating (this information may be public)'),
+ '$lbl_rating_txt' => t('Optionally explain your rating (this information may be public)'),
+ '$rating_txt' => $contact['abook_rating_text'],
+ '$rating' => $rating,
+ '$rating_val' => $contact['abook_rating'],
'$slide' => $slide,
'$tabs' => $t,
'$tab_str' => $tab_str,
diff --git a/mod/poco.php b/mod/poco.php
index 3f932e92f..892d79801 100644
--- a/mod/poco.php
+++ b/mod/poco.php
@@ -178,7 +178,8 @@ function poco_init(&$a) {
if($fields_ret['photos'])
$entry['photos'] = array(array('value' => $rr['xchan_photo_l'], 'mimetype' => $rr['xchan_photo_mimetype'], 'type' => 'profile'));
if($fields_ret['rating']) {
- $entry['rating'] = ((array_key_exists('abook_rating',$rr)) ? array(intval($rr['abook_rating'])) : 0);
+ $entry['rating'] = ((array_key_exists('abook_rating',$rr)) ? intval($rr['abook_rating'])) : 0);
+ $entry['rating_text'] = ((array_key_exists('abook_rating_text',$rr)) ? $rr['abook_rating_text'])) : '');
// maybe this should be a composite calculated rating in $system_mode
if($system_mode)
$entry['rating'] = 0;
diff --git a/mod/prep.php b/mod/prep.php
new file mode 100644
index 000000000..e53f7ac4e
--- /dev/null
+++ b/mod/prep.php
@@ -0,0 +1,38 @@
+<?php
+
+function prep_content(&$a) {
+
+ if(argc() > 1)
+ $hash = argv(1);
+
+ if(! $hash) {
+ notice('Must supply a channel identififier.');
+ return;
+ }
+
+ $p = q("select * from xchan where xchan_hash like '%s'",
+ dbesc($hash . '%')
+ );
+
+ $r = q("select * from xlink left join xchan on xlink_xchan = xchan_hash where xlink_link like '%s' and xlink_rating != 0",
+ dbesc($hash . '%')
+ );
+
+ $ret = array();
+
+ if($p && $r) {
+ $ret['poi'] = $p[0];
+ $ret['raters'] = $r;
+
+ $o = replace_macros(get_markup_template('prep.tpl'),array(
+ '$header' => t('Ratings'),
+ '$poi' => $p[0],
+ '$raters' => $r
+ ));
+
+ return $o;
+ }
+ return '';
+}
+
+ \ No newline at end of file