<?php
/*===================================================+
|| # HoloCMS - Website and Content Management System
|+===================================================+
|| # Copyright © 2008 Meth0d. All rights reserved.
|| # http://www.meth0d.org
|+===================================================+
|| # HoloCMS is provided "as is" and comes without
|| # warrenty of any kind. HoloCMS is free software!
|+===================================================*/

include('../core.php');
include('../includes/session.php');

// simple check to avoid most direct access
$refer = FilterText($_SERVER['HTTP_REFERER']);
$pos = strrpos($refer, "group_profile.php");
if ($pos === false) { exit; }

$groupid = FilterText($_POST['groupId']);
if(!is_numeric($groupid)){ exit; }

$check = mysql_query("SELECT ownerid FROM groups WHERE id = '".$groupid."' LIMIT 1") or die(mysql_error());
$isowner = mysql_fetch_array($check);

if($isowner['ownerid'] != $my_id){
    exit;
}

$check = mysql_query("SELECT * FROM groups WHERE id = '".$groupid."' LIMIT 1") or die(mysql_error());
$valid = mysql_num_rows($check);

if($valid > 0){ $groupdata = mysql_fetch_assoc($check); } else {exit; }

?>
<div id="badge-editor-flash" align="center">
<strong>Installa Flash Player Se Non Vedi Questo Editor</strong>
</div>
<script type="text/javascript" language="JavaScript">
var swfobj = new SWFObject("flash/BadgeEditor.swf", "badgeEditor", "280", "366", "8");
swfobj.addParam("base", "flash/");
swfobj.addParam("bgcolor", "#FFFFFF");
swfobj.addVariable("post_url", "../save_group_badge.php");
swfobj.addVariable("__app_key", "Meth0d.org");
swfobj.addVariable("groupId", "<?php echo $groupid; ?>");
swfobj.addVariable("badge_data", "<?php echo $groupdata['badge']; ?>");
swfobj.addVariable("localization_url", "badge_editor.xml");
swfobj.addVariable("xml_url", "badge_data.xml");
swfobj.addParam("allowScriptAccess", "always");
swfobj.write("badge-editor-flash");
</script>