<?php

if ( ! @include_once( './mainfile.php' ) ) { exit( '!! INCLUDE ERROR. ACCESS DENIED !!' ); }
error_reporting( _E_VALUE );


/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | myPHPNuke Version 188_8 RC2                                          |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Author: myPHPNuke Dev Team                                           |
// +----------------------------------------------------------------------+
// | Copyright: © 2001-2004 myPHPNuke Dev Team                            |
// +----------------------------------------------------------------------+
// $Id: editmediatypes.php,v 1.8.2.2 2004/04/18 12:46:51 ajvwaay Exp $



function editmediatypes() {
  global
    $adminurl,
    $module_name,
    $adminpath,
    $basepath, $mpnTables
    ;
  global $version, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2;

#  include ("header.php");
#  GraphicAdmin($hlpfile);
  OpenTable();
  echo "<center><font size=\"4\"><b>"._GALADMIN."</b></font></center>";
  CloseTable();
  echo "<br>";
  OpenTable();

  echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <td width=\"50%\"><strong>
      <a href=\"$adminurl\">"._GALCONFIG."</a> &gt; "._GALEDITMEDIATYPE."
      </strong></td>
    </tr>
    <tr><td>";
/////
print '<br>
      <p>
      <font>
      '._GALMEDIATYPEDESC.'
      </font>
      </p>
      </td></tr></table>';
      CloseTable();
      print '<br>';

      print OpenTable().'<table border="0" cellpadding="10" cellspacing="0" width="100%"><tr><td align="center">';
      print '
      <p><b>'._GALMEDIAADDTYPE.'</b></p>
      <table border="0" cellpadding="10" cellspacing="0" width="100%">
      <form method="POST" action="'.$adminurl.'">
      <input type="hidden" name="op" value="editmediatypes">
      <input type="hidden" name="type" value="new">
          <tr>
        <td valign="top">
        <font size="2"><b>'._GALMEDIACLASSTYPE.'</b></font><br>
        <select name="class">';
        $res = mysql_query("SELECT * FROM ".$mpnTables['gallery_media_class']."");
        while (list($id, $class) = mysql_fetch_row($res)) {
            print "<option value=\"$id\">$class</option>";
        }
        print '</select>
            </td>

            <td valign="top"><font face="Verdana,Arial">
          <font size="2"><b>'._GALMEDIADESCTYPE.'</b><br>
          <input type="text" name="description" size="15" value=""></font><p>
        </td>
            <td valign="top" >
          <font size="2"><b>'._GALMEDIAEXTENSION.'</b><br>
          <input type="text" name="extension" size="5" value="">
        </td>
            <td valign="top" >
          <font size="2"><b>'._GALMEDIATHUMB.'</b><br>
          <input type="text" name="thumbnail" size="15" value="">
        </td>

    </tr>
    <tr>
            <td colspan="4" align="center" valign="top">
              <font size="2"><b>'._GALMEDIATAG.'</b></font><br>
              <textarea  name="code" rows="10" cols="60"></textarea>
            </td>
        </tr>
        <tr>
        <td Align="center" colspan="4">
          <input class="button" type="submit" value="'._NEW.'" name="create">
        </td>
        </tr>
        </form>
      </table>';
      print '</td><tr></table>'.CloseTable().'<br>';


$sql = "SELECT * FROM ".$mpnTables['gallery_media_types']." ORDER BY filetype, description";
$result = mysql_query($sql);

      print OpenTable().'<table border="0" cellpadding="10" cellspacing="0" width="100%"><tr><td align="center">';
      print '
       <p><b>'._GALEDITMEDIATYPES.'</b></p>

      <table border="0" cellpadding="5" cellspacing="0" width="100%">';
    while ($row = mysql_fetch_array($result)) {
        print '
              <form method="POST" action="'.$adminurl.'">
              <input type="hidden" name="op" value="editmediatypes">
              <input type="hidden" name="type" value="edit">
              <input type="hidden" name="oldext" value="'.$row['extension'].'">

                <tr>
                <td valign="top">
                <font size="2"><b>'._GALMEDIACLASSTYPE.'</b></font><br>
                <select name="class">';
                $res = mysql_query("SELECT * FROM ".$mpnTables['gallery_media_class']."");
                $sel_filetype[$row['filetype']] = ' selected';
                while (list($id, $class) = mysql_fetch_row($res)) {
                    if (isset( $sel_filetype[$id] ))
                    {
                        print "<option value=\"$id\"$sel_filetype[$id]>$class</option>";
                    }
                    else
                    {
                        print "<option value=\"$id\">$class</option>";
                    }
                }
                print '</select>
                    </td>

                    <td valign="top"><font face="Verdana,Arial">
                  <font size="2"><b>'._GALMEDIADESCTYPE.'</b><br>
                  <input type="text" name="description" size="15" value="'.$row['description'].'"></font><p>
                </td>
                    <td valign="top" >
                  <font size="2"><b>'._GALMEDIAEXTENSION.'</b><br>
                  <input type="text" name="extension" size="5" value="'.$row['extension'].'">
                </td>
                    <td valign="top" >
                  <font size="2"><b>'._GALMEDIATHUMB.'</b><br>
                  <input type="text" name="thumbnail" size="15" value="'.$row['thumbnail'].'">
                </td>

            </tr>
            <tr>
                    <td colspan="4" align="center" valign="top">
                      <font size="2"><b>'._GALMEDIATAG.'</b></font><br>
                      <textarea  name="code" rows="10" cols="60">'.$row['displaytag'].'</textarea>
                    </td>
                </tr>
                <tr>
                <td Align="center" colspan="4">';

                addFormatOption();

                echo "<input type='hidden' name='clickit_form' value='code' />\n";
                echo "<input type='hidden' name='stripit_form' value='description|extension|thumbnail' />\n";
                echo "<input type='hidden' name='mpn_sectype' value='2' />\n";

                echo '<input class="button" type="submit" value="'._SAVE.'" name="save">&nbsp;&nbsp;
                  <input class="button" type="submit" value="'._DELETE.'" name="delete">
                  <br><hr><br>
                </td>
                </tr>
                </form>';
    }

    print '</table>';
       print '</td><tr></table>'.CloseTable().'<br>';
    print '<br>';
    // Start Of Footer
    OpenTable();
    print '
    <table><tr>
    <td>'
      ."<font face=\"Verdana,Arial\" color=\"$textcolor1\">mpn eGallery Version - $version<br>"._GALVISITUPDATE.'</font>
    </td>
    </tr></table>';
    CloseTable();
#  include("footer.php");
}

?>
