aboutsummaryrefslogtreecommitdiff
path: root/mod/sitepages/actions
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-26 18:25:08 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-26 18:25:08 +0000
commitb027f962af16d074398d1351a90d863aaf5469f3 (patch)
treecb547da86008491ce9a25cafae56800fd4944229 /mod/sitepages/actions
parentfd878435ffeb7478aa745f76dfcea608301a04ba (diff)
downloadelgg-b027f962af16d074398d1351a90d863aaf5469f3.tar.gz
elgg-b027f962af16d074398d1351a90d863aaf5469f3.tar.bz2
Updating Sitepages plugin settings for new administration layout.
git-svn-id: http://code.elgg.org/elgg/trunk@6242 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/sitepages/actions')
-rw-r--r--mod/sitepages/actions/add.php53
-rw-r--r--mod/sitepages/actions/addfront.php48
-rw-r--r--mod/sitepages/actions/addfrontsimple.php45
-rw-r--r--mod/sitepages/actions/addmeta.php36
-rw-r--r--mod/sitepages/actions/edit_settings.php50
5 files changed, 50 insertions, 182 deletions
diff --git a/mod/sitepages/actions/add.php b/mod/sitepages/actions/add.php
deleted file mode 100644
index bc38d8067..000000000
--- a/mod/sitepages/actions/add.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Site pages save/edit
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- *
- */
-
-// Make sure we're logged as admin
-admin_gatekeeper();
-
-// Get input data
-$content = get_input('sitepages_content', '', FALSE);
-$page_type = get_input('page_type');
-$tags = get_input('sitepages_tags');
-$tag_array = string_to_tag_array($tags);
-
-// Cache to the session for sticky forms
-// @todo make these work.
-$_SESSION['sitepages_content'] = $content;
-$_SESSION['sitepages_type'] = $type;
-$_SESSION['sitepages_tags'] = $tags;
-
-if (!$sitepage = sitepages_get_sitepage_object($page_type)) {
- $sitepage = sitepages_create_sitepage_object($page_type);
-}
-
-if (empty($content)) {
- register_error(elgg_echo('sitepages:blank'));
-} else {
- $sitepage->title = $type;
- $sitepage->description = $content;
- $sitepage->tags = $tag_array;
-
- if (!$sitepage->save()) {
- register_error(elgg_echo('sitepages:error'));
- } else {
- system_message(elgg_echo('sitepages:posted'));
- // @todo this needs to be accurate for create or update.
- add_to_river('river/sitepages/create', 'create', $_SESSION['user']->guid, $sitepages->guid);
- }
-
- // @todo Good intensions...
- unset($_SESSION['sitepages_content']);
- unset($_SESSION['sitepagestitle']);
- unset($_SESSION['sitepagestags']);
-}
-
-forward($_SERVER['HTTP_REFERER']); \ No newline at end of file
diff --git a/mod/sitepages/actions/addfront.php b/mod/sitepages/actions/addfront.php
deleted file mode 100644
index 00b04dbcb..000000000
--- a/mod/sitepages/actions/addfront.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Site pages front page save/edit
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- *
- */
-
-admin_gatekeeper();
-
-$logged_in_content = get_input('logged_in_content', '', FALSE);
-$logged_out_content = get_input('logged_out_content', '', FALSE);
-
-// do some error checking to make sure you can't lock yourself out of your front page.
-if (FALSE === strpos($logged_out_content, '[loginbox]')) {
- register_error(elgg_echo('sitepages:error:no_login'));
- forward($_SERVER['HTTP_REFERER']);
-}
-
-$css = get_input('css', '', FALSE);
-$loggedin_user_guid = get_loggedin_userid();
-
-// Cache to the session for sticky forms
-// @todo does nothing yet.
-$_SESSION['sitepages:content'] = $content;
-$_SESSION['sitepages:css'] = $css;
-
-if (!$sitepage = sitepages_get_sitepage_object('front')) {
- $sitepage = sitepages_create_sitepage_object('front');
-}
-
-$sitepage->css = $css;
-$sitepage->logged_in_content = $logged_in_content;
-$sitepage->logged_out_content = $logged_out_content;
-
-if ($sitepage->save()) {
- system_message(elgg_echo("sitepages:posted"));
- unset($_SESSION['sitepages:content']);
- unset($_SESSION['sitepages:css']);
-} else {
- register_error(elgg_echo("sitepages:error"));
-}
-
-forward($_SERVER['HTTP_REFERER']);
diff --git a/mod/sitepages/actions/addfrontsimple.php b/mod/sitepages/actions/addfrontsimple.php
deleted file mode 100644
index ee26723e8..000000000
--- a/mod/sitepages/actions/addfrontsimple.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * Site pages front page save/edit
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- *
- */
-
-admin_gatekeeper();
-
-$logged_in_content = get_input('logged_in_content', '', FALSE);
-$logged_out_content = get_input('logged_out_content', '', FALSE);
-
-$welcometitle = get_input('welcometitle', '', FALSE);
-$welcomemessage = get_input('welcomemessage', '', FALSE);
-$sidebartitle = get_input('sidebartitle', '', FALSE);
-$sidebarmessage = get_input('sidebarmessage', '', FALSE);
-
-$loggedin_user_guid = get_loggedin_userid();
-
-// Cache to the session for sticky forms
-// @todo does nothing yet.
-$_SESSION['sitepages:content'] = $content;
-$_SESSION['sitepages:css'] = $css;
-
-if (!$sitepagesimple = sitepages_get_sitepage_object('frontsimple')) {
- $sitepagesimple = sitepages_create_sitepage_object('frontsimple');
-}
-
-$sitepagesimple->welcometitle = $welcometitle;
-$sitepagesimple->welcomemessage = $welcomemessage;
-$sitepagesimple->sidebartitle = $sidebartitle;
-$sitepagesimple->sidebarmessage = $sidebarmessage;
-
-if ($sitepagesimple->save()) {
- system_message(elgg_echo("sitepagessimple:posted"));
-} else {
- register_error(elgg_echo("sitepages:error"));
-}
-
-forward($_SERVER['HTTP_REFERER']);
diff --git a/mod/sitepages/actions/addmeta.php b/mod/sitepages/actions/addmeta.php
deleted file mode 100644
index ec72d6339..000000000
--- a/mod/sitepages/actions/addmeta.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Site pages meta tags and desc page save/edit
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- *
- */
-
-admin_gatekeeper();
-
-$description = get_input('description', '', FALSE);
-$metatags = get_input('metatags', '', FALSE);
-
-// Cache to the session
-$_SESSION['description'] = $description;
-$_SESSION['metatags'] = $metatags;
-
-if (!$sitepage = sitepages_get_sitepage_object('seo')) {
- $sitepage = sitepages_create_sitepage_object('seo');
-}
-
-$sitepage->title = $metatags;
-$sitepage->description = $description;
-
-if ($sitepage->save()) {
- system_message(elgg_echo("sitepages:seocreated"));
- unset($_SESSION['description']); unset($_SESSION['metatags']);
-} else {
- register_error(elgg_echo("sitepages:error"));
-}
-
-forward($_SERVER['HTTP_REFERER']); \ No newline at end of file
diff --git a/mod/sitepages/actions/edit_settings.php b/mod/sitepages/actions/edit_settings.php
new file mode 100644
index 000000000..d79c38240
--- /dev/null
+++ b/mod/sitepages/actions/edit_settings.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ *
+ */
+
+$page_type = get_input('page_type', 'frontsimple');
+if (!$sitepage = sitepages_get_sitepage_object($page_type)) {
+ $sitepage = sitepages_create_sitepage_object($page_type);
+}
+
+switch ($page_type) {
+ case 'about':
+ case 'terms':
+ case 'privacy':
+ $content = get_input('sitepages_content', '', FALSE);
+ if (empty($content)) {
+ register_error(elgg_echo('sitepages:blank'));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ //$sitepage->title = $page_type;
+ $sitepage->description = $content;
+ $sitepage->tags = string_to_tag_array(get_input('sitepages_tags'));
+
+ break;
+ case 'seo':
+ $sitepage->title = get_input('metatags', '', FALSE);;
+ $sitepage->description = get_input('description', '', FALSE);
+
+ break;
+ case 'frontsimple':
+ default:
+ $params = get_input('params', array());
+ set_plugin_setting('ownfrontpage', $params['ownfrontpage'], 'sitepages');
+
+ $sitepage->welcometitle = get_input('welcometitle', '', FALSE);
+ $sitepage->welcomemessage = get_input('welcomemessage', '', FALSE);
+ $sitepage->sidebartitle = get_input('sidebartitle', '', FALSE);
+ $sitepage->sidebarmessage = get_input('sidebarmessage', '', FALSE);
+
+ break;
+}
+
+if ($sitepage->save()) {
+ system_message(elgg_echo('sitepages:posted'));
+} else {
+ register_error(elgg_echo('sitepages:error'));
+}
+
+forward($_SERVER['HTTP_REFERER']);