aboutsummaryrefslogtreecommitdiff
path: root/mod/sitepages/actions/addmeta.php
blob: ec72d633970960747a4e697723e0c5962c5e9814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?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']);