<?PHP
$pluginname = "phcodes";
$plugindesc = "phorum formating codes";
$pluginversion = "0.1";


if(isset($pluginprops)) {
  if(isset($plugchanged)) {
     if(!isset($HTTP_POST_VARS["chkautourl"])) $chkautourl="OFF";
     if(!isset($HTTP_POST_VARS["chkphocdes"])) $chkphocdes="OFF";
    $num=1;
    $data="<?PHP\n\$pluginphcodes = array();\n";
    $data .="\$pluginphcodes[\"autourl\"] = \"$chkautourl\";\n";
    $data .="\$pluginphcodes[\"phocdes\"] = \"$chkphocdes\";\n";
    $data .= "?>\n";
    if($fp = @fopen("./plugin/$plugindirname/settings.php","w")) {
      fputs($fp,$data);
      fclose($fp);
      $pluginphcodes["autourl"] =$chkautourl;
      $pluginphcodes["phocdes"] =$chkphocdes;

    } else {
      echo("Permission denied for writing \"plugin/$plugindirname/settings.php\", please check file permissions.\n<br>");
      echo("Optionally, you may issue the following command from the phorum directory:<br>\n");
      echo("<p><div align=\"left\">cat &lt;&lt;EOF &gt; plugin/$plugindirname/settings.php<br>\n".nl2br(htmlspecialchars(str_replace("\$","\\$",$data)))."EOF</div></p>\n");
    }
  } else {
    echo "\n<p>used else </p>\n";
    include("./plugin/replace/settings.php");
  }
echo("<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr>");
echo("<td align=\"center\" valign=\"middle\" bgcolor=\"#000080\" colspan=\"2\"><font face=\"Arial,Helvetica\" color=\"#FFFFFF\"><b>Manage Plugins - $pluginname</b></td></tr>");
echo("<form action=\"$PHP_SELF?$QUERY_STRING\" method=\"POST\">\n");

echo("<tr><td align=\"left\" bgcolor=\"#FFFFFF\" colspan=\"2\"><font face=\"Arial,Helvetica\">");
echo '<p><input type="hidden" name="plugchanged" value="1"></p>';
echo (" <p><input type=\"checkbox\" name=\"chkautourl\" value=\"ON\"");
if($pluginphcodes["autourl"]=="ON") echo (" checked");
echo ("> Enable Autorul</p>");

echo ("<p> <input type=\"checkbox\" name=\"chkphocdes\" value=\"ON\"");
if($pluginphcodes["phocdes"]=="ON") echo (" checked");
echo (">  Enable Phorum Codes</p>");
echo("\n</font></td></tr>");


  echo("<tr><td align=\"center\" bgcolor=\"#FFFFFF\" colspan=\"2\"><font face=\"Arial,Helvetica\">");

echo("<input type=\"submit\" value=\" Apply \">\n");
echo("</form>\n</td></tr>");
echo("</tr>\n</table>");}


?>