aboutsummaryrefslogtreecommitdiffstats
path: root/mod/pdledit.php
diff options
context:
space:
mode:
authormarijus <mario@mariovavti.com>2014-03-05 17:03:38 +0100
committermarijus <mario@mariovavti.com>2014-03-05 17:03:38 +0100
commit6cdc25ade96c4451e87af475a6e4f0490b591c36 (patch)
tree474ebb0f31063805d8b95dcddc22d4345c989936 /mod/pdledit.php
parentffb791968e48b5699dc99fffccc562f198f86c5d (diff)
parentd58abc0230e07663ce543088c186639d36f82f02 (diff)
downloadvolse-hubzilla-6cdc25ade96c4451e87af475a6e4f0490b591c36.tar.gz
volse-hubzilla-6cdc25ade96c4451e87af475a6e4f0490b591c36.tar.bz2
volse-hubzilla-6cdc25ade96c4451e87af475a6e4f0490b591c36.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod/pdledit.php')
-rw-r--r--mod/pdledit.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/mod/pdledit.php b/mod/pdledit.php
new file mode 100644
index 000000000..36b9a0c14
--- /dev/null
+++ b/mod/pdledit.php
@@ -0,0 +1,62 @@
+<?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:'),
+ '$help' => t('Layout Help'),
+ '$module' => argv(1),
+ '$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+}