File: //home/httpd/mech_ftp/baretube.com/admin/modules/awempire/awempire.php
<?php
ignore_user_abort();
ini_set('max_execution_time', 86400);
include('functions.api.php');
require "../../header.php";
$result = dbQuery("SELECT * FROM configuration WHERE `field` = 'AWEmpirePSID'",false);
if(!is_array($result)) {
dbQuery("INSERT INTO configuration SET field_name = \"AWEmpire PSID\", field_description = \"AWEmpire PSID\", field = \"AWEmpirePSID\", `value` = \"mechbunny\", `data` = '', weight = '99', `group` = 'general'");
$writeConfig = true;
}
$result = dbQuery("SELECT * FROM configuration WHERE `field` = 'AWEmpireAccessKey'",false);
if(!is_array($result)) {
dbQuery("INSERT INTO configuration SET field_name = \"AWEmpire Access Key\", field_description = \"AWEmpire API Access Key\", field = \"AWEmpireAccessKey\", `value` = \"\", `data` = '', weight = '99', `group` = 'general'");
$writeConfig = true;
}
$result = dbQuery("SELECT * FROM configuration WHERE `field` = 'AWEmpirePrimaryColor'",false);
if(!is_array($result)) {
dbQuery("INSERT INTO configuration SET field_name = \"AWEmpire Primary Color\", field_description = \"AWEmpire Primary Color\", field = \"AWEmpirePrimaryColor\", `value` = \"FF9900\", `data` = '', weight = '99', `group` = 'general'");
$writeConfig = true;
}
$result = dbQuery("SELECT * FROM configuration WHERE `field` = 'AWEmpirePrimaryColor'",false);
if(!is_array($result)) {
dbQuery("INSERT INTO configuration SET field_name = \"AWEmpire Primary Color\", field_description = \"AWEmpire Primary Color\", field = \"AWEmpirePrimaryColor\", `value` = \"FF9900\", `data` = '', weight = '99', `group` = 'general'");
$writeConfig = true;
}
$result = dbQuery("SELECT * FROM configuration WHERE `field` = 'AWEmpireLabelColor'",false);
if(!is_array($result)) {
dbQuery("INSERT INTO configuration SET field_name = \"AWEmpire Label Color\", field_description = \"AWEmpire Label Color\", field = \"AWEmpireLabelColor\", `value` = \"000000\", `data` = '', weight = '99', `group` = 'general'");
$writeConfig = true;
}
$result = dbQuery("SELECT * FROM configuration WHERE `field` = 'AWEmpireCampaignID'",false);
if(!is_array($result)) {
dbQuery("INSERT INTO configuration SET field_name = \"AWEmpire Campaign ID\", field_description = \"AWEmpire Campaign ID\", field = \"AWEmpireCampaignID\", `value` = \"\", `data` = '', weight = '99', `group` = 'general'");
$writeConfig = true;
}
$result = dbQuery("SELECT * FROM configuration WHERE `field` = 'AWEmpireEnabled'",false);
if(!is_array($result)) {
dbQuery("INSERT INTO configuration SET field_name = \"Enable AWEmpire Live API\", field_description = \"Enable AWEmpire Live API\", field = \"AWEmpireEnabled\", `value` = \"1\", `data` = '{\"true\":1,\"false\":0}', weight = '99', `group` = 'general'");
$writeConfig = true;
}
if($writeConfig) {
$output = array();
$results = dbQuery("SELECT * FROM `configuration`", false);
foreach ($results as $row) {
$output[$row['field']] = $row['value'];
}
file_put_contents("$basepath/admin/scripts/config.json", json_encode($output));
}
if ($_POST) {
//$_POST = mysql_real_escape_array($_POST);
}
?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="awempire.php">AWEmpire API</a></span>
</div>
</div>
<div class="content-outer">
<h2>AWEmpire<strong>API</strong></h2>
<div class="notification info">This module lets you add feeds from the AWEmpire Video API endpoint. PSID is your AWEmpire username, and Access Key is from the URL when you generate a video. The settings below can be manipulated in the <a href='<? echo $basehttp; ?>/admin/settings.php'>admin area settings page</a> under the "General" section.</div>
<div class="notification info">
<a href='https://mechbunny.com/awempire' target='_blank' style='font-weight: bold;'>Click here to make an account at AWEmpire. Please make sure adblock is disabled.</a>
</div>
<div class="notification info">
<strong>Usage Instructions:</strong><br />
Usage instructions go here..
</div>
<? if ($outputMsg) { ?><div class="notification success"><? echo $outputMsg; ?></div><? } ?>
<div class="content-inner">
<form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th colspan="2">Configuration</th>
</tr>
</thead>
<tbody>
<tr>
<td>PSID</td>
<td><? echo htmlentities($AWEmpirePSID); ?></td>
</tr>
<tr>
<td>Access Key</td>
<td><? echo htmlentities($AWEmpireAccessKey); ?></td>
</tr>
<tr>
<td>Campaign ID</td>
<td><? echo htmlentities($AWEmpireCampaignID); ?></td>
</tr>
<tr>
<td>Primary Color</td>
<td>#<? echo htmlentities($AWEmpirePrimaryColor); ?></td>
</tr>
<tr>
<td>Label Color</td>
<td><? echo htmlentities($AWEmpireLabelColor); ?></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<? require "../../footer.php"; ?>