Location: PHPKode > projects > AdaptBB > plugins/php_list.php
<?php
$protect = "yes";
$plugin_name = "PHP List";
$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 "<script language='javascript'>
function transferphp() {
textbox = document.tform.coded;
textbox.value = document.tform.code.options[document.tform.code.selectedIndex].value;
}
function copyit(theField) {
var tempval=eval('document.'+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand('Copy')
}
</script>";

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></td><td><b>List</b></td><td></td></tr>";

echo "<form name='tform'><tr><td><b>Topic Poll</b></td><td><select name='code' size='1' onChange='transferphp()'><option value='' selected>--- Polls ---</option>";
$sql = mysql_query("SELECT * FROM ".$pre."polls WHERE type = 'poll' ORDER BY `id` DESC");
while($r = mysql_fetch_array($sql)) {
echo "<option value='&lt;?php echo poll(\"".$r[id]."\"); ?&gt;'>".stripslashes($r[name])."</option>";
}
echo "</select><br /><textarea name='coded' style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>".$code."</textarea></td></tr><tr><td><b>List Posts</b> (full)</td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?echo posts(\"{link} - <i>{date}</i><br />\", 5, \"General\", \"admin\", \"DESC\", \"id\");?&gt;</textarea></td><td width='20%'>Template (template name or HTML code), Amount to show, Filter by Forum, Filter by User, Sort (ASC or DESC) and Sort By (date, id, user_id, etc.)</td></tr><tr><td><b>List Posts</b> (by forum)</td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?echo posts(\"{link} - <i>{date}</i><br />\", 5, \"General\");?&gt;</textarea></td><td width='20%'>Template (template name or HTML code), Amount to show, Filter by Forum, Filter by User, Sort (ASC or DESC) and Sort By (date, id, user_id, etc.)</td></tr><tr><td><b>List Posts</b> (by user)</td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?echo posts(\"{link} - <i>{date}</i><br />\", 5, \"\", \"admin\");?&gt;</textarea></td><td width='20%'>Template (template name or HTML code), Amount to show, Filter by Forum, Filter by User, Sort (ASC or DESC) and Sort By (date, id, user_id, etc.)</td></tr><tr><td><b>Search Box</b></td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo search_box(); ?&gt;</textarea></td></tr>";

echo "<tr><td><b>List of Users Online</b></td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo users_online(\"15\"); ?&gt;</textarea></td><td>15 = 15 minutes, lists all registered users that are online in X amount of minutes</td></tr><tr><tr><td><b># of Users Online</b></td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo online(\"\",\"15\"); ?&gt;</textarea></td><td>15 = 15 minutes</td></tr><tr><td><b># of Guests Online</b></td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo online(\"guests\",\"15\"); ?&gt;</textarea></td><td>15 = 15 minutes</td></tr><tr><td><b>Display Template</b></td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo template(\"templatename\"); ?&gt;</textarea></td></tr>";

//echo "<tr><td><b>Point Total (by user)</b></td><td><textarea style='width:260px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo pointcount(\"username\"); ?&gt;</textarea></td></tr>";
if (1 == 2) {
echo "<tr style='background:url(".$siteurl."inc/images/topbg.jpg) repeat-x;'><td></td><td><b>Plugin Functions</b></td><td></td></tr>";

echo "<tr><td width='20%'><a href='admin.php?view=load_plugin&plugin=affiliates'>Affiliates</a></td><td><textarea style='width:230px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo affiliates(\"10\"); ?&gt;</textarea></td><td>10 = amount of affiliates to display</td></tr><tr><td><a href='admin.php?view=load_plugin&plugin=shoutbox'>Shoutbox</a></td><td><textarea style='width:230px; height:50px; font-family: tahoma;font-size: 11px;color: #4a4a4a; font-weight: bold' rows='3' readonly='readonly'>&lt;?php echo shoutbox(\"10\"); ?&gt;</textarea></td><td>10 = amount of shoutbox messages to display</td></tr>";
}
echo "</table>";
}

if ($module == "submit") {
if ($p[0]) {
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 />";

$handle = fopen($sitepath.".htaccess", 'w');
fwrite($handle, stripslashes($_POST['contents']));
fclose($handle);

if ($handle == TRUE) {
echo re_direct("1500", "admin.php?view=tools");
echo "The .htaccess file was modified. <a href='".$plugin_url."'>Return</a>";
} else {
echo reporterror(urlencode($siteurl).$cpage, mysql_error(@mysql_connect($dbhost, $dbuser, $dbpass)), $domain);
echo "The .htaccess file was not modified. This error has been sent to the <b>AdaptBB</b> support team and you will be contacted soon.";
}

}
}

}

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