aboutsummaryrefslogtreecommitdiffstats
path: root/mod/pdledit.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-04 18:12:27 -0800
committerfriendica <info@friendica.com>2014-03-04 18:12:27 -0800
commitaa9d25f51764c7bbd2922d6e91f609e89659b2f6 (patch)
treee97e585ca1c9e6862c1c90328893727a23731f64 /mod/pdledit.php
parenta072668f8a92a2accf2eb270a7307e5574a389c6 (diff)
downloadvolse-hubzilla-aa9d25f51764c7bbd2922d6e91f609e89659b2f6.tar.gz
volse-hubzilla-aa9d25f51764c7bbd2922d6e91f609e89659b2f6.tar.bz2
volse-hubzilla-aa9d25f51764c7bbd2922d6e91f609e89659b2f6.zip
add system PDL editor (lets you change/personalise the layout for any module which has a system PDL file.)
Diffstat (limited to 'mod/pdledit.php')
-rw-r--r--mod/pdledit.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/mod/pdledit.php b/mod/pdledit.php
new file mode 100644
index 000000000..e3ff2292d
--- /dev/null
+++ b/mod/pdledit.php
@@ -0,0 +1,61 @@
+<?php
+
+function pdledit_post(&$a) {
+ if(! local_user())
+ return;
+ if(! $_REQUEST['module'])
+ return;
+ if(! trim($_REQUEST['content'])) {
+ del_pconfig(local_user(),'system','mod_' . $_REQUEST['module'] . '.pdl');
+ goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
+ }
+ set_pconfig(local_user(),'system','mod_' . $_REQUEST['module'] . '.pdl',escape_tags($_REQUEST['content']));
+ info( t('Layout updated.') . EOL);
+ goaway(z_root() . '/pdledit/' . $_REQUEST['module']);
+}
+
+
+function pdledit_content(&$a) {
+
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ if(argc() > 1)
+ $module = 'mod_' . argv(1) . '.pdl';
+ else {
+ $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 />';
+ }
+ }
+ }
+
+ // list module pdl files
+ return $o;
+ }
+
+ $t = get_pconfig(local_user(),'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:'),
+ '$module' => argv(1),
+ '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+}