aboutsummaryrefslogtreecommitdiff
path: root/mod/sitepages/actions/addmeta.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-09 00:52:52 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-09 00:52:52 +0000
commit4e2a58e02ae4fe55ebc801a816c6ddb304df4b18 (patch)
treef958306f06db27bc2182f30356bead605b2d4b93 /mod/sitepages/actions/addmeta.php
parent617ebb97d840cf77f3b483273f029732e8dc0db7 (diff)
downloadelgg-4e2a58e02ae4fe55ebc801a816c6ddb304df4b18.tar.gz
elgg-4e2a58e02ae4fe55ebc801a816c6ddb304df4b18.tar.bz2
Brought sitepages up to standards.
Added basic static keyword/view substitution support. git-svn-id: http://code.elgg.org/elgg/trunk@5312 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/sitepages/actions/addmeta.php')
-rw-r--r--mod/sitepages/actions/addmeta.php59
1 files changed, 23 insertions, 36 deletions
diff --git a/mod/sitepages/actions/addmeta.php b/mod/sitepages/actions/addmeta.php
index 432152ef1..e9f40cdb4 100644
--- a/mod/sitepages/actions/addmeta.php
+++ b/mod/sitepages/actions/addmeta.php
@@ -1,49 +1,36 @@
<?php
/**
- * Elgg SEO: add/edit
+ * 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/
+ *
*/
-// Make sure we're logged as admin
admin_gatekeeper();
-// Get input data
-$description = get_input('description', '', false);
-$metatags = get_input('metatags', '', false);
-$previous_guid = get_input('seo_guid');
-
-//remove the old front page
-if(get_entity($previous_guid)){
- delete_entity($previous_guid);
-}
+$description = get_input('description', '', FALSE);
+$metatags = get_input('metatags', '', FALSE);
// Cache to the session
$_SESSION['description'] = $description;
$_SESSION['metatags'] = $metatags;
-
-// Initialise a new ElggObject
-$seo = new ElggObject();
-// Tell the system what type of external page it is
-$seo->subtype = "sitemeta";
-// Set its owner to the current user
-$seo->owner_guid = $_SESSION['user']->getGUID();
-// Set its access to public
-$seo->access_id = 2;
-// Set its title and description appropriately
-$seo->title = $metatags;
-$seo->description = $description;
-
-// Before we can set metadata, save
-if (!$seo->save()) {
- register_error(elgg_echo("sitepages:error"));
- forward("pg/sitepages/index.php?type=seo");
+
+if (!$sitepage = sitepages_get_sitepage_object('front')) {
+ $sitepage = sitepages_create_sitepage_object('front');
}
-// Success message
-system_message(elgg_echo("sitepages:seocreated"));
+$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"));
+}
-// Remove the cache
-unset($_SESSION['description']); unset($_SESSION['metatags']);
-
-
-// Forward back to the page
-forward("pg/sitepages/index.php?type=seo");
+forward($_SERVER['HTTP_REFERER']); \ No newline at end of file