<?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: editallcategories.php,v 1.4.2.2 2004/04/18 12:46:51 ajvwaay Exp $




function editallcategories()
{
    global $adminurl, $module_name, $imagepath, $gallerypath, $adminpath, $languagepath, $baseurl, $adminurl, $modulepath;
    global $version, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $GalleryPictureName, $mpnTables, $textcolor1;

    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>
      <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
      <tr>
      <td><strong>
      <a href=\"$adminurl\">"._GALCONFIG."</a> &gt;
      "._GALEDITALLCATEGORIES."
      </strong>
      </td>
      </tr>
      </table>
      </td>
      </tr>
      <tr>
      <td bgcolor=\"$bgcolor3\">
      <table border=\"0\" bgcolor=\"$bgcolor3\" width=\"100%\">
      <tr>
      <td width=\"25%\" valign=\"top\">
      <font size=\"2\"><b>"._GALECDCATEGORIES."</b></font>
      </td>
      <td width=\"75%\">"._GALECDCATEGORIESDESC."
      <p></p>

      <!-- <form method=\"POST\" action=\"$adminurl\">
      <input type=\"hidden\" name=\"op\" value=\"editcategory\">
      <input type=submit name=\"save\" value=\""._GALSAVECHANGES."\"> <input type=reset name=\"reset\" value=\"Reset\"> -->
      <hr size=\"1\" color=\"#000000\">

          <p></p>
      <table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#000000\">
      <tr>
      <td>
      <table border=\"0\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"$bgcolor1\">
      <tr>
      <td>
      <a href=\"$adminurl&amp;op=showeditcategory&amp;parent=-1\">"._GALCLICK2CREATECAT."</a>.
      </td>
      </tr>
      </table>
      </td>
      </tr>
      </table>
      <br>";

    list($numcategories) = mysql_fetch_array(mysql_query("SELECT count(*) from ".$mpnTables['gallery_categories'].""));
    if ($numcategories>0)
    {
    $categories = listcategories("$gallerypath");
    $categories = explode(" ", trim($categories));
    $cpt = 0;

    while(list($key, $val) = each($categories))
        {
        $result = mysql_query("select gallid, galloc, gallname, parent, visible, gallimg from ".$mpnTables['gallery_categories']." where gallid=".$val);
        list ($gid, $galloc, $name, $parent, $visible, $gallimg) = mysql_fetch_row($result);

            $tab = indent($gid)*50;
        list($count) = mysql_fetch_row(mysql_query("SELECT count(*) FROM ".$mpnTables['gallery_pictures']." WHERE gid=$gid"));
            echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
          <tr>
          <td>
          <img src=\"$imagepath/blank.gif\" height=\"20\" width=\"$tab\">
          </td>
          <td>
          <table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#000000\">
          <tr>
          <td>
          <table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"$bgcolor1\">
          <tr>
          <td>
          <font size=\"2\">
          $name [<a href=\"$adminurl&amp;op=showeditcategory&amp;category=$gid\">"._GALCATEDIT."</a>]
          [<a href=\"$adminurl&amp;op=movecategory&type=move&category=$gid\">"._GALCATMOVE."</a>]
          [<a href=\"$adminurl&amp;op=editcategory&type=delete&category=$gid\" onClick=\"return confirm('"._GALSURE2DELETECAT."')\">"._GALCATDELETE."</a>]
          [<a href=\"$adminurl&amp;op=showeditcategory&parent=$gid\">"._GALCATCREATESUB."</a>]
          </font>
          <hr color=\"#000000\" height=\"1\">
          <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
          <tr>
          <td align=\"left\">
          <img src=\"$gallerypath/$galloc/$gallimg\" width=\"50\" border=\"0\">
          </td>
          <td align=\"right\">
          "._GALCATMEDIACOUNT." $count<br>
          "._GALCATSTATE. " ";

            switch ($visible)
            {
                case 0:
            print "<a href=\"$adminurl&amp;op=editcategory&amp;type=status&amp;visible=1&amp;category=$gid\" title=\""._GALVISIBLEADMIN.'">'._GALVISIBLEADMIN."&nbsp;<img src=\"$imagepath/red_dot.gif\" border=\"0\" width=\"10\" height=\"10\" alt=\""._GALVISIBLEADMIN.'"></a>&nbsp;';
            break;

                case 1:
            print "<a href=\"$adminurl&amp;op=editcategory&amp;type=status&amp;visible=2&amp;category=$gid\" title=\""._GALVISIBLEMEMBER.'">'._GALVISIBLEMEMBER."&nbsp;<img src=\"$imagepath/yellow_dot.gif\" border=\"0\" width=\"10\" height=\"10\" alt=\""._GALVISIBLEMEMBER.'"></a>&nbsp;';
            break;

                default:
                print "<a href=\"$adminurl&amp;op=editcategory&amp;type=status&amp;visible=0&amp;category=$gid\" title=\""._GALVISIBLEPUBLIC.'">'._GALVISIBLEPUBLIC."&nbsp;<img src=\"$imagepath/green_dot.gif\" border=\"0\" width=\"10\" height=\"10\" alt=\""._GALVISIBLEPUBLIC.'"></a>&nbsp;';
            break;
            }

             print "</td>
                </tr>
                    </table>
                </td>
                </tr>
                </table>
                </td>
                </tr>
                </table>
                </td>
                </tr>
                </table>
                <br>";
        }// While
    }

    echo "<hr size=\"1\" color=\"#000000\">
          <!--<input type=\"submit\" name=\"save\" value=\""._GALSAVECHANGES."\"> <input type=\"reset\" name=\"reset\" value=\"Reset\">
      </form> -->
      </td>
      </tr>
      </table>
      </td>
      </tr>
     </table>";

    CloseTable();
    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();
}

?>
