diff options
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Directory.php | 12 | ||||
-rw-r--r-- | Zotlabs/Module/Hq.php | 5 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 20 | ||||
-rw-r--r-- | Zotlabs/Module/Pdledit_gui.php | 553 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Calendar.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Channel.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Channel_home.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Connections.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Directory.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Editor.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Events.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Manage.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Network.php | 8 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Photos.php | 12 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Privacy.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Profiles.php | 4 |
17 files changed, 630 insertions, 65 deletions
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index b39887c9e..da37c582f 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -254,21 +254,21 @@ class Directory extends Controller { $connect_link = ''; $location = ''; - if(strlen($rr['locale'])) + if(isset($rr['locale'])) $location .= $rr['locale']; - if(strlen($rr['region'])) { - if(strlen($rr['locale'])) + if(isset($rr['region'])) { + if($location) $location .= ', '; $location .= $rr['region']; } - if(strlen($rr['country'])) { - if(strlen($location)) + if(isset($rr['country'])) { + if($location) $location .= ', '; $location .= $rr['country']; } $age = ''; - if(strlen($rr['birthday'])) { + if(isset($rr['birthday'])) { if(($years = age($rr['birthday'],'UTC','')) > 0) $age = $years; } diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 29b0df739..5001bbe62 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -27,6 +27,8 @@ class Hq extends \Zotlabs\Web\Controller { return; } + $item_hash = ''; + if(argc() > 1 && argv(1) !== 'load') { $item_hash = unpack_link_id(argv(1)); } @@ -97,7 +99,7 @@ class Hq extends \Zotlabs\Web\Controller { 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], - 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'), 'permissions' => $channel_acl, 'bang' => '', @@ -112,6 +114,7 @@ class Hq extends \Zotlabs\Web\Controller { 'reset' => t('Reset form') ]; + $a = ''; $o = status_editor($a, $x, true); } diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 41a4e120d..574a90c1a 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -695,6 +695,7 @@ class Item extends Controller { $expires = $orig_post['expires']; $comments_closed = $orig_post['comments_closed']; $mid = $orig_post['mid']; + $thr_parent = $orig_post['thr_parent']; $parent_mid = $orig_post['parent_mid']; $plink = $orig_post['plink']; } @@ -1092,7 +1093,7 @@ class Item extends Controller { $datarray['created'] = $created; $datarray['edited'] = (($orig_post) ? datetime_convert() : $created); $datarray['expires'] = $expires; - $datarray['comments_closed'] = $comments_closed; + $datarray['comments_closed'] = (($nocomment) ? $created : $comments_closed); $datarray['commented'] = (($orig_post) ? datetime_convert() : $created); $datarray['received'] = (($orig_post) ? datetime_convert() : $created); $datarray['changed'] = (($orig_post) ? datetime_convert() : $created); diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 016a0a309..f4f6cc8d1 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -272,15 +272,17 @@ class Network extends \Zotlabs\Web\Controller { $likes_sql = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; // This is for nouveau view public forum cid queries (if a forum notification is clicked) - $p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'", - intval(local_channel()), - intval(TERM_FORUM), - dbesc($cid_r[0]['xchan_name']) - ); - - $p_str = ids_to_querystr($p, 'parent'); - if($p_str) - $p_sql = " OR item.parent IN ( $p_str ) "; + //$p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'", + //intval(local_channel()), + //intval(TERM_FORUM), + //dbesc($cid_r[0]['xchan_name']) + //); + + //$p_str = ids_to_querystr($p, 'parent'); + + $p_sql = ''; + //if($p_str) + //$p_sql = " OR item.parent IN ( $p_str ) "; $sql_extra = " AND ( owner_xchan = '" . protect_sprintf(dbesc($cid_r[0]['abook_xchan'])) . "' OR owner_xchan = '" . protect_sprintf(dbesc($cid_r[0]['abook_xchan'])) . "' $p_sql ) AND item_unseen = 1 $likes_sql "; } diff --git a/Zotlabs/Module/Pdledit_gui.php b/Zotlabs/Module/Pdledit_gui.php new file mode 100644 index 000000000..b550b92d3 --- /dev/null +++ b/Zotlabs/Module/Pdledit_gui.php @@ -0,0 +1,553 @@ +<?php + +namespace Zotlabs\Module; + +use App; +use Zotlabs\Web\Controller; +use Zotlabs\Render\Comanche; +use Zotlabs\Lib\Libsync; + +class Pdledit_gui extends Controller { + + function post() { + + if (!local_channel()) { + return; + } + + if (!$_REQUEST['module']) { + return; + } + + $module = $_REQUEST['module']; + + $ret = [ + 'success' => false, + 'module' => $module + ]; + + if ($_REQUEST['reset']) { + del_pconfig(local_channel(), 'system', 'mod_' . $module . '.pdl'); + Libsync::build_sync_packet(); + $ret['success'] = true; + json_return_and_die($ret); + } + + if ($_REQUEST['save']) { + if (!$_REQUEST['data']) { + return $ret; + } + + $data = json_decode($_REQUEST['data'],true); + $stored_pdl_result = self::get_pdl($module); + $pdl = $stored_pdl_result['pdl']; + + foreach ($data as $region => $entries) { + $region_pdl = ''; + foreach ($entries as $entry) { + $region_pdl .= base64_decode($entry) . "\r\n"; + } + $pdl = preg_replace('/\[region=' . $region . '\](.*?)\[\/region\]/ism', '[region=' . $region . ']' . "\r\n" . $region_pdl . "\r\n" . '[/region]', $pdl); + } + + set_pconfig(local_channel(), 'system', 'mod_' . $module . '.pdl', escape_tags($pdl)); + Libsync::build_sync_packet(); + + $ret['success'] = true; + json_return_and_die($ret); + } + + if ($_REQUEST['save_src']) { + set_pconfig(local_channel(), 'system', 'mod_' . $module . '.pdl', escape_tags($_REQUEST['src'])); + Libsync::build_sync_packet(); + + $ret['success'] = true; + json_return_and_die($ret); + } + + if ($_REQUEST['save_template']) { + if (!$_REQUEST['data']) { + return $ret; + } + + $template = $_REQUEST['data'][0]['value']; + $pdl_result = self::get_pdl($module); + $stored_template = self::get_template($pdl_result['pdl']); + + if ($template === $stored_template) { + $ret['success'] = true; + return $ret; + } + + $cnt = preg_match("/\[template\](.*?)\[\/template\]/ism", $pdl_result['pdl'], $matches); + if ($cnt) { + $pdl = str_replace('[template]' . $stored_template . '[/template]', '[template]' . $template . '[/template]', $pdl_result['pdl']); + } + else { + $pdl = '[template]' . $template . '[/template]' . "\r\n"; + $pdl .= $pdl_result['pdl']; + } + + set_pconfig(local_channel(), 'system', 'mod_' . $module . '.pdl', escape_tags($pdl)); + Libsync::build_sync_packet(); + + $ret['success'] = true; + json_return_and_die($ret); + } + + } + + function get() { + + if(! local_channel()) { + return EMPTY_STR; + } + + $module = argv(1); + + if (!$module) { + goaway(z_root() . '/pdledit_gui/hq'); + } + + $pdl_result = self::get_pdl($module); + + $pdl = $pdl_result['pdl']; + $modified = $pdl_result['modified']; + + if(!$pdl) { + return t('Layout not found'); + } + + $template = self::get_template($pdl); + + $template_info = self::get_template_info($template); + + if(empty($template_info['contentregion'])) { + return t('This template does not support pdledi_gui (no content regions defined)'); + } + + App::$page['template'] = $template; + + $regions = self::get_regions($pdl); + + foreach ($regions as $k => $v) { + $region_str = ''; + if (is_array($v)) { + ksort($v); + foreach ($v as $entry) { + // Get the info from the file and replace entry if we get anything useful + $widget_info = get_widget_info($entry['name']); + $entry['name'] = (($widget_info['name']) ? $widget_info['name'] : $entry['name']); + $entry['desc'] = (($widget_info['description']) ? $widget_info['description'] : $entry['desc']); + + $region_str .= replace_macros(get_markup_template('pdledit_gui_item.tpl'), [ + '$entry' => $entry + ]); + } + } + App::$layout['region_' . $k] = $region_str; + } + + $templates = self::get_templates(); + $templates_html = replace_macros(get_markup_template('pdledit_gui_templates.tpl'), [ + '$templates' => $templates, + '$active' => $template + ]); + + $items_html = ''; + + //$items_html .= replace_macros(get_markup_template('pdledit_gui_item.tpl'), [ + //'$entry' => [ + //'type' => 'content', + //'name' => t('Main page content'), + //'src' => base64_encode('$content') + //], + //'$disable_controls' => true + //]); + + foreach (self::get_widgets($module) as $entry) { + $items_html .= replace_macros(get_markup_template('pdledit_gui_item.tpl'), [ + '$entry' => $entry, + '$disable_controls' => true + ]); + } + + foreach (self::get_menus() as $entry) { + $items_html .= replace_macros(get_markup_template('pdledit_gui_item.tpl'), [ + '$entry' => $entry, + '$disable_controls' => true + ]); + } + + foreach (self::get_blocks() as $entry) { + $items_html .= replace_macros(get_markup_template('pdledit_gui_item.tpl'), [ + '$entry' => $entry, + '$disable_controls' => true + ]); + } + + App::$layout['region_content'] .= replace_macros(get_markup_template('pdledit_gui.tpl'), [ + '$content_regions' => $template_info['contentregion'], + '$page_src' => base64_encode($pdl), + '$templates' => base64_encode($templates_html), + '$modules' => base64_encode(self::get_modules()), + '$items' => base64_encode($items_html), + '$module_modified' => $modified, + '$module' => $module + ]); + + } + + function get_templates() { + $ret = []; + + $files = glob('view/php/*.php'); + if($files) { + foreach($files as $f) { + $name = basename($f, '.php'); + $x = get_template_info($name); + if(!empty($x['contentregion'])) { + $ret[] = [ + 'name' => $name, + 'desc' => $x['description'] + ]; + } + } + } + + return $ret; + } + + function get_modules() { + $ret = ''; + + $files = glob('Zotlabs/Module/*.php'); + if($files) { + foreach($files as $f) { + $name = lcfirst(basename($f,'.php')); + + if ($name === 'admin' && !is_site_admin()) { + continue; + } + + $x = theme_include('mod_' . $name . '.pdl'); + if($x) { + $ret .= '<div class="mb-2"><a href="pdledit_gui/' . $name . '">' . $name . '</a></div>'; + } + } + } + + return $ret; + } + + function get_widgets($module) { + $ret = []; + + $checkpaths = [ + 'Zotlabs/Widget/*.php' + ]; + + foreach ($checkpaths as $path) { + $files = glob($path); + if($files) { + foreach($files as $f) { + $name = lcfirst(basename($f, '.php')); + + $widget_info = get_widget_info($name); + if ($widget_info['requires'] && strpos($widget_info['requires'], 'admin') !== false && !is_site_admin()) { + continue; + } + + if ($widget_info['requires'] && strpos($widget_info['requires'], $module) === false) { + continue; + } + + $ret[] = [ + 'type' => 'widget', + 'name' => $widget_info['name'] ?? $name, + 'desc' => $widget_info['description'] ?? '', + 'src' => base64_encode('[widget=' . $name . '][/widget]') + ]; + } + } + } + + return $ret; + } + + function get_menus() { + $ret = []; + + $r = q("select * from menu where menu_channel_id = %d and menu_flags = 0", + intval(local_channel()) + ); + + foreach ($r as $rr) { + $name = $rr['menu_name']; + $desc = $rr['menu_desc']; + $ret[] = [ + 'type' => 'menu', + 'name' => $name, + 'desc' => $desc, + 'src' => base64_encode('[menu]' . $name . '[/menu]') + ]; + } + + return $ret; + } + + function get_blocks() { + $ret = []; + + $r = q("select v, title, summary from item join iconfig on iconfig.iid = item.id and item.uid = %d + and iconfig.cat = 'system' and iconfig.k = 'BUILDBLOCK'", + intval(local_channel()) + ); + + foreach ($r as $rr) { + $name = $rr['v']; + $desc = (($rr['title']) ? $rr['title'] : $rr['summary']); + $ret[] = [ + 'type' => 'block', + 'name' => $name, + 'desc' => $desc, + 'src' => base64_encode('[block]' . $name . '[/block]') + ]; + } + + return $ret; + } + + function get_template($pdl) { + $ret = 'default'; + + $cnt = preg_match("/\[template\](.*?)\[\/template\]/ism", $pdl, $matches); + if($cnt && isset($matches[1])) { + $ret = trim($matches[1]); + } + + return $ret; + } + + function get_regions($pdl) { + $ret = []; + $supported_regions = ['aside', 'content', 'right_aside']; + + $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $pdl, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + if (!in_array($mtch[1], $supported_regions)) { + continue; + } + $ret[$mtch[1]] = self::parse_region($mtch[2]); + } + } + + return $ret; + } + + function parse_region($pdl) { + $ret = []; + + $cnt = preg_match_all('/\$content\b/ism', $pdl, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); + if($cnt) { + foreach($matches as $mtch) { + $offset = intval($mtch[0][1]); + $name = trim($mtch[0][0]); + //$src = base64url_encode(preg_replace(['/\s*\[/', '/\]\s*/'], ['[', ']'], $mtch[0][0])); + $src = base64_encode($mtch[0][0]); + $ret[$offset] = [ + 'type' => 'content', + 'name' => t('Main page content'), + 'desc' => t('The main page content can not be edited!'), + 'src' => $src + ]; + } + } + + $cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $pdl, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); + if($cnt) { + foreach($matches as $mtch) { + $offset = intval($mtch[1][1]); + $name = trim($mtch[1][0]); + //$src = base64url_encode(preg_replace(['/\s*\[/', '/\]\s*/'], ['[', ']'], $mtch[0][0])); + $src = base64_encode($mtch[0][0]); + + $ret[$offset] = [ + 'type' => 'menu', + 'name' => $name, + 'desc' => '', + 'src' => $src + ]; + } + } + + // menu class e.g. [menu=horizontal]my_menu[/menu] or [menu=tabbed]my_menu[/menu] + // allows different menu renderings to be applied + + //$cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER); + //if($cnt) { + //foreach($matches as $mtch) { + //$s = str_replace($mtch[0],$this->menu(trim($mtch[2]),$mtch[1]),$s); + //} + //} + + + $cnt = preg_match_all("/\[block\](.*?)\[\/block\]/ism", $pdl, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); + if($cnt) { + foreach($matches as $mtch) { + $offset = intval($mtch[1][1]); + $name = trim($mtch[1][0]); + //$src = base64url_encode(preg_replace(['/\s*\[/', '/\]\s*/'], ['[', ']'], $mtch[0][0])); + $src = base64_encode($mtch[0][0]); + $ret[$offset] = [ + 'type' => 'block', + 'name' => $name, + 'desc' => '', + 'src' => $src + ]; + } + } + + //$cnt = preg_match_all("/\[block=(.*?)\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER); + //if($cnt) { + //foreach($matches as $mtch) { + //$s = str_replace($mtch[0],$this->block(trim($mtch[2]),trim($mtch[1])),$s); + //} + //} + + //$cnt = preg_match_all("/\[js\](.*?)\[\/js\]/ism", $s, $matches, PREG_SET_ORDER); + //if($cnt) { + //foreach($matches as $mtch) { + //$s = str_replace($mtch[0],$this->js(trim($mtch[1])),$s); + //} + //} + + //$cnt = preg_match_all("/\[css\](.*?)\[\/css\]/ism", $s, $matches, PREG_SET_ORDER); + //if($cnt) { + //foreach($matches as $mtch) { + //$s = str_replace($mtch[0],$this->css(trim($mtch[1])),$s); + //} + //} + + // need to modify this to accept parameters + + $cnt = preg_match_all("/\[widget=(.*?)\](.*?)\[\/widget\]/ism", $pdl, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); + + if($cnt) { + foreach($matches as $mtch) { + $offset = intval($mtch[1][1]); + $name = trim($mtch[1][0]); + //$src = base64url_encode(preg_replace(['/\s*\[/', '/\]\s*/'], ['[', ']'], $mtch[0][0])); + $src = base64_encode($mtch[0][0]); + $ret[$offset] = [ + 'type' => 'widget', + 'name' => $name, + 'desc' => '', + 'src' => $src + ]; + } + } + + return $ret; + + } + + + /** + * @brief Parse template comment in search of template info. + * + * like + * \code + * * Name: MyWidget + * * Description: A widget + * * Version: 1.2.3 + * * Author: John <profile url> + * * Author: Jane <email> + * * ContentRegionID: some_id + * * ContentRegionID: some_other_id + * * + *\endcode + * @param string $template the name of the template + * @return array with the information + */ + function get_template_info($template){ + $m = []; + $info = [ + 'name' => $template, + 'description' => '', + 'author' => [], + 'maintainer' => [], + 'version' => '', + 'contentregion' => [] + ]; + + $checkpaths = [ + 'view/php/' . $template . '.php', + ]; + + $template_found = false; + + foreach ($checkpaths as $path) { + if (is_file($path)) { + $template_found = true; + $f = file_get_contents($path); + break; + } + } + + if(!($template_found && $f)) + return $info; + + $f = escape_tags($f); + $r = preg_match('|/\*.*\*/|msU', $f, $m); + + if ($r) { + $ll = explode("\n", $m[0]); + foreach($ll as $l) { + $l = trim($l, "\t\n\r */"); + if ($l != ''){ + list($k, $v) = array_map('trim', explode(':', $l, 2)); + $k = strtolower($k); + if (in_array($k, ['author', 'maintainer'])){ + $r = preg_match('|([^<]+)<([^>]+)>|', $v, $m); + if ($r) { + $info[$k][] = array('name' => $m[1], 'link' => $m[2]); + } else { + $info[$k][] = array('name' => $v); + } + } + elseif (in_array($k, ['contentregion'])){ + $info[$k][] = array_map('trim', explode(',', $v)); + } + else { + $info[$k] = $v; + } + } + } + } + + return $info; + } + + function get_pdl($module) { + $ret = [ + 'pdl' => null, + 'modified' => true + ]; + + $pdl_path = 'mod_' . $module . '.pdl'; + + $ret['pdl'] = get_pconfig(local_channel(), 'system', $pdl_path); + + if(!$ret['pdl']) { + $pdl_path = theme_include($pdl_path); + if ($pdl_path) { + $ret['pdl'] = file_get_contents($pdl_path); + $ret['modified'] = false; + } + } + + return $ret; + } +} diff --git a/Zotlabs/Module/Settings/Calendar.php b/Zotlabs/Module/Settings/Calendar.php index ab85eb450..65240c635 100644 --- a/Zotlabs/Module/Settings/Calendar.php +++ b/Zotlabs/Module/Settings/Calendar.php @@ -11,14 +11,14 @@ class Calendar { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -34,14 +34,14 @@ class Calendar { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Calendar Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index a0da020b7..840efc162 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -35,6 +35,8 @@ class Channel { $pageflags = $channel['channel_pageflags']; $existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0); $expire = ((x($_POST, 'expire')) ? intval($_POST['expire']) : 0); + $incl = ((x($_POST['message_filter_incl'])) ? htmlspecialchars_decode(trim($_POST['message_filter_incl']), ENT_QUOTES) : ''); + $excl = ((x($_POST['message_filter_excl'])) ? htmlspecialchars_decode(trim($_POST['message_filter_excl']), ENT_QUOTES) : ''); if ($adult != $existing_adult) { $pageflags = ($pageflags ^ PAGE_ADULT); @@ -131,6 +133,8 @@ class Channel { set_pconfig(local_channel(), 'system', 'photo_path', $photo_path); set_pconfig(local_channel(), 'system', 'attach_path', $attach_path); set_pconfig(local_channel(), 'system', 'email_notify_host', $mailhost); + set_pconfig(local_channel(), 'system', 'message_filter_incl', $incl); + set_pconfig(local_channel(), 'system', 'message_filter_excl', $excl); $r = q("update channel set channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_expire_days = %d @@ -277,6 +281,8 @@ class Channel { '$removeme' => t('Remove Channel'), '$removechannel' => t('Remove this channel.'), '$expire' => ['expire', t('Expire other channel content after this many days'), $expire, t('0 or blank to use the website limit.') . ' ' . ((intval($sys_expire)) ? sprintf(t('This website expires after %d days.'), intval($sys_expire)) : t('This website does not expire imported content.')) . ' ' . t('The website limit takes precedence if lower than your limit.')], + '$message_filter_excl' => ['message_filter_excl', t('Do not import posts with this text'), get_pconfig(local_channel(), 'system', 'message_filter_excl', ''), t('Words one per line or #tags, $categories, /patterns/, lang=xx, lang!=xx - leave blank to import all posts')], + '$message_filter_incl' => ['message_filter_incl', t('Only import posts with this text'), get_pconfig(local_channel(), 'system', 'message_filter_incl', ''), t('Words one per line or #tags, $categories, /patterns/, lang=xx, lang!=xx - leave blank to import all posts')] ]); call_hooks('settings_form', $o); diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php index e8faa7fb2..470dbe4c3 100644 --- a/Zotlabs/Module/Settings/Channel_home.php +++ b/Zotlabs/Module/Settings/Channel_home.php @@ -13,7 +13,7 @@ class Channel_home { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); @@ -25,10 +25,10 @@ class Channel_home { $channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : ''); set_pconfig(local_channel(),'system','channel_menu',$channel_menu); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -82,7 +82,7 @@ class Channel_home { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Channel Home Settings'), @@ -90,7 +90,7 @@ class Channel_home { '$extra_settings_html' => $extra_settings_html, '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Connections.php b/Zotlabs/Module/Settings/Connections.php index 4369deb27..52a95a3d1 100644 --- a/Zotlabs/Module/Settings/Connections.php +++ b/Zotlabs/Module/Settings/Connections.php @@ -11,14 +11,14 @@ class Connections { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -34,14 +34,14 @@ class Connections { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Connections Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Directory.php b/Zotlabs/Module/Settings/Directory.php index d1dd0677e..09ea61f60 100644 --- a/Zotlabs/Module/Settings/Directory.php +++ b/Zotlabs/Module/Settings/Directory.php @@ -11,14 +11,14 @@ class Directory { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -34,14 +34,14 @@ class Directory { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Directory Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index cf6dd2807..85c3e69ae 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -11,14 +11,14 @@ class Editor { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -34,14 +34,14 @@ class Editor { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Editor Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Events.php b/Zotlabs/Module/Settings/Events.php index ab393c932..0a0e3516c 100644 --- a/Zotlabs/Module/Settings/Events.php +++ b/Zotlabs/Module/Settings/Events.php @@ -11,14 +11,14 @@ class Events { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -34,14 +34,14 @@ class Events { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Events Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Manage.php b/Zotlabs/Module/Settings/Manage.php index cbc494cf8..6fb57eafb 100644 --- a/Zotlabs/Module/Settings/Manage.php +++ b/Zotlabs/Module/Settings/Manage.php @@ -12,14 +12,14 @@ class Manage { $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -35,14 +35,14 @@ class Manage { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Channel Manager Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php index 9f5bdb2e5..eae963a25 100644 --- a/Zotlabs/Module/Settings/Network.php +++ b/Zotlabs/Module/Settings/Network.php @@ -21,10 +21,10 @@ class Network { $network_divmore_height = 50; set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -53,7 +53,7 @@ class Network { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Stream Settings'), @@ -61,7 +61,7 @@ class Network { '$extra_settings_html' => $extra_settings_html, '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Photos.php b/Zotlabs/Module/Settings/Photos.php index 8195d660b..f68c8847b 100644 --- a/Zotlabs/Module/Settings/Photos.php +++ b/Zotlabs/Module/Settings/Photos.php @@ -7,18 +7,18 @@ use Zotlabs\Lib\Libsync; class Photos { function post() { - + $module = substr(strrchr(strtolower(static::class), '\\'), 1); check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); - + Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -34,14 +34,14 @@ class Photos { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Photos Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - + return $o; } diff --git a/Zotlabs/Module/Settings/Privacy.php b/Zotlabs/Module/Settings/Privacy.php index fbda78a6f..847bb3b8f 100644 --- a/Zotlabs/Module/Settings/Privacy.php +++ b/Zotlabs/Module/Settings/Privacy.php @@ -119,7 +119,7 @@ class Privacy { ], '$autoperms' => ['autoperms', t('Automatically approve new contacts'), $autoperms, '', [t('No'), t('Yes')]], '$index_opt_out' => ['index_opt_out', t('Opt-out of search engine indexing'), $index_opt_out, '', [t('No'), t('Yes')]], - '$group_actor' => ['group_actor', t('Group actor'), $group_actor, t('Allow this channel to act as a forum'), [t('No'), t('Yes')]], + '$group_actor' => ['group_actor', t('Group actor'), $group_actor, t('Allow this channel to act as a forum'), [t('No'), t('Yes')]] ]); return $o; diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php index a1a1b8d96..0ff2dfb6d 100644 --- a/Zotlabs/Module/Settings/Profiles.php +++ b/Zotlabs/Module/Settings/Profiles.php @@ -23,7 +23,7 @@ class Profiles { Libsync::build_sync_packet(); - if($_POST['rpath']) + if(isset($_POST['rpath']) && is_local_url($_POST['rpath'])) goaway($_POST['rpath']); return; @@ -43,7 +43,7 @@ class Profiles { $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( - '$rpath' => $rpath, + '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Profiles Settings'), |