Location: PHPKode > projects > AdaptBB > plugins/cms_integration.php
<?php
$protect = "yes";
$plugin_name = "CMS Integration";
$plugin_url = "admin.php?view=plugins&do=load&plugin=".strtolower(str_replace(" ", "_", $plugin_name));
$plugin_version = "1.0";
$url = strtolower(str_replace(" ", "_", $plugin_name)).".php";

$apage = basename($_SERVER['PHP_SELF']);
$siteurl = "http://".$_SERVER['HTTP_HOST'].str_replace($apage, "", $_SERVER['PHP_SELF']);
$url = $_GET['url'];

if ($_GET['check'] == "status") {
echo 1;
}

if ($module == "install_".$url) {
$tot = 0;
if (mysql_num_rows(mysql_query("SELECT * FROM ".$pre."plugins WHERE name = '".$plugin_name."'")) > 1) {
echo "<b>".$plugin_name."</b> Plugin already installed. <a href='admin.php?view=plugins&do=install'>Return</a>";
} else {
echo "Beginning to install the <b>".$plugin_name."</b> Plugin...<br /><br />";
$query1 = mysql_query("INSERT INTO ".$pre."plugins VALUES (null, '".$plugin_name."', '".$_GET['url']."', '".$plugin_version."', 'On')");
if ($query1 == TRUE) {
$tot = $tot + 1;
echo "`".$pre."plugins` MySQL data row Inserted? <font color='green'>True</font><br />";
} else {
echo "`".$pre."plugins` MySQL data row Inserted? <font color='red'>False</font><br />";
}
if ($tot == 1) {
echo "<br /><b>".$plugin_name."</b> Plugin installed <font color='green'>Sucessfully!</font>. <a href='".$plugin_url."'>".$plugin_name." Plugin</a>";
} else {
echo "<br /><b>".$plugin_name."</b> Plugin installed <font color='red'>Un-Sucessfully!</font>. Please check mysql settings and if need be, please submit a <a href='admin.php?view=support'>support ticket</a>.";
}
}
}

if ($module == "uninstall_".$url) {
$tot = 0;
if (mysql_num_rows(mysql_query("SELECT * FROM ".$pre."plugins WHERE name = '".$plugin_name."'")) > 1) {
echo "<b>".$plugin_name."</b> Plugin already un-installed, or not yet installed. <a href='admin.php?view=plugins&do=install'>Return</a>";
} else {
echo "Beginning to un-install the <b>".$plugin_name."</b> Plugin...<br /><br />";
$query1 = mysql_query("DELETE FROM ".$pre."plugins WHERE name = '".$plugin_name."'");
if ($query1 == TRUE) {
$tot = $tot + 1;
echo "`".$pre."plugins` MySQL data row Deleted? <font color='green'>True</font><br />";
} else {
echo "`".$pre."plugins` MySQL data row Deleted? <font color='red'>False</font><br />";
}
if ($tot == 1) {
echo "<br /><b>".$plugin_name."</b> Plugin un-installed <font color='green'>Sucessfully!</font>. <a href='admin.php?view=plugins'>Plugins</a>";
echo $data;
} else {
echo "<br /><b>".$plugin_name."</b> Plugin un-installed <font color='red'>Un-Sucessfully!</font>. Please check mysql settings and if need be, please submit a <a href='admin.php?view=support'>support ticket</a>.";
echo $data;
}
}
}

if (basename($_SERVER['PHP_SELF']) == "admin.php") {
if ($module == "") {
echo "<b>Directory</b>&nbsp;&nbsp;-&nbsp;&nbsp;<a href='admin.php?view=plugins'>Plugins</a> / <a href='".$plugin_url."'>".$plugin_name." Plugin</a><br /><br /><br />";

echo "<table cellpadding='5' cellspacing='0' border='0' width='90%' align='center' style='border: 2px solid #dddddd'><tr style='background:url(".$siteurl."inc/images/topbg.jpg) repeat-x;'><td><b>Forum</b></td><td><b>Version</b></td><td><b>Website</b></td><td><b>In Use?</b></td></tr>";

$array = array("AdaptCMS|http://www.adaptcms.com" => "1.4", "OneCMS|http://www.insanevisions.com/forums" => "2.5", "Wordpress|http://www.wordpress.org" => "2.7");
$i = 0;
while (list($r, $v) = each ($array)) {
$ex = explode("|", $r);
if (($i % 2) === 0) {
echo "<tr class='light'>";
} else {
echo "<tr class='dark'>";
}
$fetch = mysql_fetch_row(mysql_query("SELECT data,id FROM ".$pre."fielddata WHERE fname = 'cms_integration' AND user_id = '".$ex[0]."'"));
if ($fetch[0]) {
$inuse = "<font color='blue'>Yes</font>";
$ids = "&id=".$fetch[1];
} else {
$inuse = "No";
}
echo "<td><a href='".$plugin_url."&module=".strtolower(str_replace(" ", "_", $ex[0])).$ids."'>".$ex[0]."</a></td><td>".$v."</td><td><a href='".$ex[1]."' target='new'>".check_domain($ex[1])."</a></td><td>".$inuse."</td></tr>";
$i = $i + 1;
}
echo "</table>";
}

if ($module == "adaptcms") {
echo "<b>Directory</b>&nbsp;&nbsp;-&nbsp;&nbsp;<a href='admin.php?view=plugins'>Plugins</a> / <a href='".$plugin_url."'>".$plugin_name." Plugin</a><br /><br /><br />";

echo "<form action='".$plugin_url."&module=adaptcms2' method='post'><table cellpadding='5' cellspacing='0' border='0' width='90%' align='center' style='border: 2px solid #dddddd'><tr style='background:url(".$siteurl."inc/images/topbg.jpg) repeat-x;'><td><b>CMS Integration</b></td><td></td></tr>";
if ($_GET['id']) {
$r = mysql_fetch_row(mysql_query("SELECT data FROM ".$pre."fielddata WHERE id = '".$_GET['id']."'"));
echo "<tr class='light'><td><b>AdaptCMS Database Prefix</b></td><td><input type='text' name='preu' class='input' value='".$r[0]."'></td></tr><tr class='dark'><td><b>Disable Integration?</b></td><td><input type='checkbox' name='delete' class='input' value='yes'><input type='hidden' name='id' value='".$_GET['id']."'></td></tr>";
} else {
echo "<tr><td><b>AdaptCMS Database Prefix</b></td><td><input type='text' name='preu' class='input' value='adaptcms_'></td></tr>";
}

echo "<tr><td><input type='submit' value='Proceed' class='input' onclick='return confirmProceed();'></td></tr></table></form>";
}

if ($module == "adaptcms2") {
echo "<b>Directory</b>&nbsp;&nbsp;-&nbsp;&nbsp;<a href='admin.php?view=plugins'>Plugins</a> / <a href='".$plugin_url."'>".$plugin_name." Plugin</a><br /><br /><br />";

echo "<table cellpadding='5' cellspacing='0' border='0' width='90%' align='center' style='border: 2px solid #dddddd'><tr style='background:url(".$siteurl."inc/images/topbg.jpg) repeat-x;'><td><b>CMS Integration</b></td><td></td></tr>";
if ($_POST['id'] && $_POST['delete']) {
if (mysql_query("DELETE FROM ".$pre."fielddata WHERE id = '".$_POST['id']."'") == TRUE) {
echo "<tr><td>CMS Integration Removed? <font color='blue'>YES</font></td></tr>";
} else {
echo "<tr><td>CMS Integration Removed? <font color='red'>NO</font></td></tr>";
}
} elseif ($_POST['id'] && !$_POST['delete']) {
if (mysql_query("UPDATE ".$pre."fielddata SET data = '".$_POST['preu']."' WHERE id = '".$_POST['id']."'") == TRUE) {
echo "<tr><td>CMS Integration Updated? <font color='blue'>YES</font></td></tr>";
} else {
echo "<tr><td>CMS Integration Updated? <font color='red'>NO</font></td></tr>";
}
} elseif (!$_POST['id'] && !$_POST['delete']) {
if (mysql_query("INSERT INTO ".$pre."fielddata VALUES (null, 'cms_integration', '".$_POST['preu']."', 'AdaptCMS')") == TRUE) {
echo "<tr><td>CMS Integration Successful? <font color='blue'>YES</font></td></tr>";
} else {
echo "<tr><td>CMS Integration Successful? <font color='red'>NO</font></td></tr>";
}
}
echo "</table>";
}

}

if (basename($_SERVER['PHP_SELF']) == "index.php") {
if ($module == strtolower(str_replace(" ", "_", $plugin_name))) {
echo 1;
}
}
?>
Return current item: AdaptBB