<?php
if(!isset($_SESSION)) 
session_start();
if(!isset($_SESSION['admin_wsvc']))
{
header("location: admin.php");
}
include 'common/header.php';
$error = "";
 ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- TemplateBeginEditable name="doctitle" -->
<title>Edit Social Profiles: <?php echo(get_title()) ?></title>
</head>
<body class="metrouicss" onload="prettyPrint()">
<div class="container" style="width:940px;margin: auto">
<div class="page">
<div class="nav-bar" style="background:<?php echo(retColor()); ?>">
    <div class="nav-bar-inner padding10">
        <span class="pull-menu"></span>

        <a href="<?php echo(rootpath()) ?>"><span class="element brand">
            <img class="place-left" src="images/logo32.png" style="height: 20px"/>
            <?php echo(get_title()) ?>
        </span></a>
    </div>
</div>
</div>

    <div class="page secondary with-sidebar">
        <div class="page-header">
            <div class="page-header-content">
                <h1>Social Profiles</h1>
                <a href="#" onclick="window.history.back();" class="back-button big page-back"></a>
            </div>
        </div>

        <?php include 'inc/sidebar.php'; ?>

        <div class="page-region">
            <div class="page-region-content">
                <div class="span5" style="padding-top:50px">
                     <div class="grid">
					 <div class="row">
					 <?php

if(isset($_POST['facebook']))
{
if(isset($_POST['facebook']) && $_POST["facebook"]!="")
{
if(valid_facebook_url($_POST["facebook"]) && $_POST["facebook"]!="")
$facebook = $_POST["facebook"];
else
$error .="o. Invalid Facebook Page ID/Name<br />";
}
if(isset($_POST['twitter']) && $_POST["twitter"]!="")
{
if(valid_twitter_username($_POST["twitter"]) && $_POST["twitter"]!="")
$twitter = $_POST["twitter"];
else
$error .="o. Invalid Twitter Username<br />";
}
if(isset($_POST['google']) && $_POST["google"]!="")
{
if(valid_google_url($_POST["google"]))
$google = $_POST["google"];
else
$error .="o. Invalid Google+ Page ID<br />";
}
if($error=="")
{
update_social($facebook,$twitter,$google);
}
}
?>
<form action="social.php" method="post">
<ul>
<h3>Facebook Fanpage ID/Name</h3> 
<div class="input-control text span5">
<input type="text" name="facebook" placeholder="eg. 140579349349503" value="<?php echo(get_facebook()) ?>" />
</div>
<h3>Twitter Username</h3> 
<div class="input-control text span5">
<input type="text" name="twitter" placeholder="eg. Twitter" value="<?php echo(get_twitter()) ?>" />
</div>
<h3>Google+ Page ID</h3> 
<div class="input-control text span5">
<input type="text" name="google" placeholder="eg. 102298766131242211273" value="<?php echo(get_google()) ?>" />
</div>
<div class="span5">
<input type="submit" class="bg-color-green" value="Update">
</div>
<?php
if(isset($_POST['facebook']))
{
?>
<span class="label success">Social Profiles Updated Successfully</span>
<?php 
}
?>
</ul>
</form>
</div>                </div>

				</div>
            </div>
        </div>
    </div>

<?php include 'common/footer.php'; ?>