aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Pdledit.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-04-20 21:05:01 -0400
committerAndrew Manning <tamanning@zoho.com>2016-04-20 21:05:01 -0400
commitb96eb1c8230ae2f5986d6f22934c606bbca9728e (patch)
treefecd2279927b61da28801094dc7d6b1cfa8d98fe /Zotlabs/Module/Pdledit.php
parent7594796ee11c0b245d02d145868a13ac3d84ebfc (diff)
parent635580091a227529cb491e6441a5acbfff3177be (diff)
downloadvolse-hubzilla-b96eb1c8230ae2f5986d6f22934c606bbca9728e.tar.gz
volse-hubzilla-b96eb1c8230ae2f5986d6f22934c606bbca9728e.tar.bz2
volse-hubzilla-b96eb1c8230ae2f5986d6f22934c606bbca9728e.zip
Merge branch 'dev' into toggle-context-help
Diffstat (limited to 'Zotlabs/Module/Pdledit.php')
-rw-r--r--Zotlabs/Module/Pdledit.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php
new file mode 100644
index 000000000..accfb6fa1
--- /dev/null
+++ b/Zotlabs/Module/Pdledit.php
@@ -0,0 +1,72 @@
+<?php
+namespace Zotlabs\Module;
+
+
+class Pdledit extends \Zotlabs\Web\Controller {
+
+ function post() {
+ if(! local_channel())
+ return;
+ if(! $_REQUEST['module'])
+ return;
+ if(! trim($_REQUEST['content'])) {
+ del_pconfig(local_channel(),'system','mod_' . $_REQUEST['module'] . '.pdl');
+ goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
+ }
+ set_pconfig(local_channel(),'system','mod_' . $_REQUEST['module'] . '.pdl',escape_tags($_REQUEST['content']));
+ build_sync_packet();
+ info( t('Layout updated.') . EOL);
+ goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
+ }
+
+
+ function get() {
+
+ if(! local_channel()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ if(argc() > 1)
+ $module = 'mod_' . argv(1) . '.pdl';
+ else {
+ $o .= '<div class="generic-content-wrapper-styled">';
+ $o .= '<h1>' . t('Edit System Page Description') . '</h1>';
+ $files = glob('mod/*');
+ if($files) {
+ foreach($files as $f) {
+ $name = basename($f,'.php');
+ $x = theme_include('mod_' . $name . '.pdl');
+ if($x) {
+ $o .= '<a href="pdledit/' . $name . '" >' . $name . '</a><br />';
+ }
+ }
+ }
+
+ $o .= '</div>';
+
+ // list module pdl files
+ return $o;
+ }
+
+ $t = get_pconfig(local_channel(),'system',$module);
+ if(! $t)
+ $t = file_get_contents(theme_include($module));
+ if(! $t) {
+ notice( t('Layout not found.') . EOL);
+ return '';
+ }
+
+ $o = replace_macros(get_markup_template('pdledit.tpl'),array(
+ '$header' => t('Edit System Page Description'),
+ '$mname' => t('Module Name:'),
+ '$help' => t('Layout Help'),
+ '$module' => argv(1),
+ '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+ }
+
+}