From 5967360991cb3766a6517759369b6d6fd8563c61 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 22 Jan 2018 16:49:45 -0800 Subject: hubzilla issue #920 - unable to delete permission groups with space in name --- Zotlabs/Module/Settings/Permcats.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php index 336f69653..535399083 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Settings/Permcats.php @@ -49,7 +49,7 @@ class Permcats { if(argc() > 2) - $name = argv(2); + $name = hex2bin(argv(2)); if(argc() > 3 && argv(3) === 'drop') { \Zotlabs\Lib\Permcat::delete(local_channel(),$name); @@ -70,7 +70,7 @@ class Permcats { if(($pc['name']) && ($name) && ($pc['name'] == $name)) $existing = $pc['perms']; if(! $pc['system']) - $permcats[$pc['name']] = $pc['localname']; + $permcats[bin2hex($pc['name'])] = $pc['localname']; } } -- cgit v1.2.3 From 4cfd7b65fba13b86450730aabdd7f37ea8e2afa9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 22 Jan 2018 20:07:08 -0800 Subject: siteinfo embellishments --- Zotlabs/Module/Siteinfo.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php index fafd51f65..92ee78cc6 100644 --- a/Zotlabs/Module/Siteinfo.php +++ b/Zotlabs/Module/Siteinfo.php @@ -5,7 +5,6 @@ namespace Zotlabs\Module; class Siteinfo extends \Zotlabs\Web\Controller { function init() { -logger(print_r($_REQUEST,true)); if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') { $data = get_site_info(); json_return_and_die($data); -- cgit v1.2.3 From 4b7947d98c0625cfc53b481e2240a275e48c0d19 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 23 Jan 2018 16:36:56 -0800 Subject: replace image cropping library --- Zotlabs/Module/Cover_photo.php | 12 ++++++------ Zotlabs/Module/Profile_photo.php | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 47bce6c2b..cfb513365 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -64,12 +64,12 @@ class Cover_photo extends \Zotlabs\Web\Controller { $image_id = substr($image_id,0,-2); } - - $srcX = $_POST['xstart']; - $srcY = $_POST['ystart']; - $srcW = $_POST['xfinal'] - $srcX; - $srcH = $_POST['yfinal'] - $srcY; - + + + $srcX = intval($_POST['xstart']); + $srcY = intval($_POST['ystart']); + $srcW = intval($_POST['xfinal']) - $srcX; + $srcH = intval($_POST['yfinal']) - $srcY; $r = q("select gender from profile where uid = %d and is_default = 1 limit 1", intval(local_channel()) diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 45a606d5f..3aa6aee79 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -1,10 +1,11 @@ Date: Tue, 23 Jan 2018 16:44:11 -0800 Subject: add units to css --- Zotlabs/Module/Profile_photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 3aa6aee79..222b92721 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -56,7 +56,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { if((array_key_exists('cropfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) { - logger('crop: ' . print_r($_POST,true)); + // logger('crop: ' . print_r($_POST,true)); -- cgit v1.2.3 From 304085606fac6ae4fd2d3e29ed44afb4b4e1bc28 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 23 Jan 2018 20:03:17 -0800 Subject: some code cleanup and simplification in mod_like --- Zotlabs/Module/Like.php | 81 +++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index b07824363..6d9fde17c 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -9,9 +9,41 @@ require_once('include/items.php'); class Like extends \Zotlabs\Web\Controller { - function get() { + + + private function reaction_to_activity($reaction) { + + $acts = [ + 'like' => ACTIVITY_LIKE , + 'dislike' => ACTIVITY_DISLIKE , + 'agree' => ACTIVITY_AGREE , + 'disagree' => ACTIVITY_DISAGREE , + 'abstain' => ACTIVITY_ABSTAIN , + 'attendyes' => ACTIVITY_ATTEND , + 'attendno' => ACTIVITY_ATTENDNO , + 'attendmaybe' => ACTIVITY_ATTENDMAYBE + ]; + + // unlike (etc.) reactions are an undo of positive reactions, rather than a negative action. + // The activity is the same in undo actions and will have the same activity mapping + + if(substr($reaction,0,2) === 'un') { + $reaction = substr($reaction,2); + } + + if(array_key_exists($reaction,$acts)) { + return $acts[$reaction]; + } + + return EMPTY_STR; + + } + + + + public function get() { - $o = ''; + $o = EMPTY_STR; $sys_channel = get_sys_channel(); $sys_channel_id = (($sys_channel) ? $sys_channel['channel_id'] : 0); @@ -35,48 +67,17 @@ class Like extends \Zotlabs\Web\Controller { if(! $verb) $verb = 'like'; - switch($verb) { - case 'like': - case 'unlike': - $activity = ACTIVITY_LIKE; - break; - case 'dislike': - case 'undislike': - $activity = ACTIVITY_DISLIKE; - break; - case 'agree': - case 'unagree': - $activity = ACTIVITY_AGREE; - break; - case 'disagree': - case 'undisagree': - $activity = ACTIVITY_DISAGREE; - break; - case 'abstain': - case 'unabstain': - $activity = ACTIVITY_ABSTAIN; - break; - case 'attendyes': - case 'unattendyes': - $activity = ACTIVITY_ATTEND; - break; - case 'attendno': - case 'unattendno': - $activity = ACTIVITY_ATTENDNO; - break; - case 'attendmaybe': - case 'unattendmaybe': - $activity = ACTIVITY_ATTENDMAYBE; - break; - default: - return; - break; + $activity = $this->reaction_to_activity($verb); + + if(! $activity) { + return EMPTY_STR; } + $extended_like = false; $object = $target = null; - $post_type = ''; - $objtype = ''; + $post_type = EMPTY_STR; + $objtype = EMPTY_STR; if(argc() == 3) { -- cgit v1.2.3