ilch Forum » Ilch Clan 1.1 » Module und Modifikationen » Admin Gallery mit Kategorien Bild

Geschlossen
  1. #1
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    Admin Gallery mit Kategorien Bild


    Hallo alle ich hätte es gerne,
    wenn Mann in AdminBereich unter Gallery Kategorien ein Bild für die Kategorie hinzufügen kann.
    Aber ich bekomme es mit der gallery.php nicht hin.
    Ich Bitte um eure HILFE!

    Das Habe ich Hinbekommen. zwinker

    ilch Admin Gallery: include/admin/templates/gallery/gallery.htm

    gesperrtes Bild

    Meine: include/admin/templates/gallery/gallery.htm
    <table border="0" class="border" cellspacing="1" cellpadding="9">
     <tr>
      <td class="Chead" colspan="1">
       <font color="#FFFFFF">
    	<img src="include/images/icons/admin/gallery.png" width="16" height="16" /> &nbsp; Gallery
       </font>
      </td>
     </tr>
     <tr>
      <td align="left" class="Cnorm">
      
    <form action="admin.php?gallery" method="POST">
    <table width="100%">
      <tr>
    	  <td valign="top" width="60%" rowspan="2">
    
          <table cellpadding="3" border="0" cellspacing="5" class="border">
            <tr>
            {EXPLODE}
            <td class="{class}" valign="top">
              <table cellpadding="2" border="0" cellspacing="1" class="border">
                <tr>
                  <td valign="top" class="{class}">
    
              <table cellpadding="1" border="0" cellspacing="0" class="border">
                <tr>
                  <td class="Cmite"><a href="javascript:del({id})"><img src="include/images/icons/del.png" border="0" title="l&ouml;schen" alt="l&ouml;schen"></a></td>
                </tr><tr>
                  <td class="Cnorm"><a href="javascript:edit('{besch}',{id})"><img src="include/images/icons/edit.png" title="&auml;ndern" border="0" alt="&auml;ndern"></a></td>
                </tr><tr>
                  <td class="Cmite"><a href="javascript:reload({id})"><img src="include/images/icons/reload.png" border="0" title="erneuern" alt="erneuern"></a></td>
                </tr><tr>
                  <td class="Cnorm"><input type="checkbox" name="img[]" value="{id}" style="margin:0px; padding: 0px;" title="Bild f&uuml;r Verschieben markieren" /></td>
                </tr>
              </table>
                  </td><td valign="top" class="{class}">
                    <img title="{datei_name} |---| {besch}" alt="{datei_name}" src="include/images/gallery/img_thumb_{id}.{endung}" />
                  </td>
                </tr>
              </table>
            </td>
            {EXPLODE}
            </tr>
          </table>
        </td>
        <td valign="top" width="40%">
    
    <table cellpadding="3" border="0" cellspacing="1" class="border">
      <tr class="Chead">
    		<td colspan="9"><b>Kategorien</b></td>
      </tr><tr class="Cmite">
        <td><a href="?gallery-S0">Keine</a></td>
        <td><a href="javascript:uploadImages(0)"><img src="include/images/icons/upload.png" title="Bilder in diese Kategorie hochladen" alt="Bilder in diese Kategorie hochladen" border="0"></a></td>
        <td><a href="javascript:reloadImages(0)"><img src="include/images/icons/reload.png" title="Bilder in diese Kategorie erneuern / einlesen" alt="Bilder in diese Kategorie erneuern / einlesen" border="0"></a></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>{EXPLODE}
    </table>
    <br />
    <table cellpadding="3" border="0" cellspacing="1" class="border">
      <tr class="Chead">
    		<td colspan="9"><b>Bilder verschieben</b></td>
      </tr><tr class="Cmite"><td>nach:</td><td><select name="movecat">{Ccat}</select></td>
      </tr><tr class="Cdark">
            <td colspan="2"><input type="submit" value="markierte Bilder verschieben" name="movepics" /></td>
      </tr>
    </table>
    <br />
    	<input type="hidden" name="Cpkey" value="{Cpkey}">
    
    	<table class="border" cellpadding="3" cellspacing="1" border="0">
        <tr class="Chead">
    		  <td colspan="2"><b>Gallery Kategorien</b></td>
    		</tr>
          <td class="Cmite">Kategorie</td>
    			<td class="Cnorm"><select name="Ccat">{Ccat}</select></td>
        </tr><tr>
          <td class="Cmite">Kategorie Bild :</td>
          <td class="Cnorm"><select onChange="sichtbar()" name="katLis">{KATS}<option value="neu">Neu:</option></select>&nbsp;&nbsp;<input type="text" name="kat" size="40"></td>
        </tr><tr>
          <td class="Cmite">Sichtbar&nbsp;ab</td>
    			<td class="Cnorm"><select name="Crecht">{Crecht}</select></td>
        </tr><tr>
          <td class="Cmite">Name</td>
    			<td class="Cnorm"><input type="text" name="Cname" value="{Cname}" /></td>
        </tr><tr>
          <td class="Cmite">Beschreibung</td>
    			<td class="Cnorm"><textarea cols="30" rows="3" name="Cdesc">{Cdesc}</textarea></td>
        </tr>
    		<tr class="Cdark">
    		  <td></td>
    			<td><input type="submit" value="Absenden" name="Csub" /></td>
    		</tr>
      </table>
    </form>
    
    </td></td></table>
    
      </td>
     </tr>
    </table>
    
    <script language="JavaScript" type="text/javascript">
    <!--
    
      function Kdel ( id1 ) {
        var Fenster = window.open ('admin.php?gallery-D' + id1, 'delKat', 'status=yes,scrollbars=yes,height=150,width=550,left=300,top=50');
        Fenster.focus();
      }
      function del ( id1 ) {
        var x = confirm ( "Dieses Bild wirklich löschen?" );
    		if ( x ) {
    		  document.location.href="?gallery-d"+id1;
    		}
    	}
      function edit ( besch, id1 ) {
        var x = prompt ( "Bitte die neue Beschreibung eingeben!", besch);
        if ( x ) {
          document.location.href="?gallery-e"+id1+"=0&besch=" + x;
        }
      }
      function reload ( id1 ) {
        var x = confirm ( "Dieses Bild wirklich erneuern?" );
        if ( x ) {
          document.location.href="?gallery-r"+id1;
        }
      }
      function reloadImages (kid) {
        var Fenster = window.open ('admin.php?gallery-reloadImages-' + kid, 'reloadImages', 'status=yes,scrollbars=yes,height=500,width=350,left=300,top=50');
        Fenster.focus();
      }
      function uploadImages (kid) {
        var x = prompt ( "Wie viele Bilder möchten Sie hochladen?", "5");
        if ( x ) {
          var Fenster = window.open ('admin.php?gallery-uploadImages-' + kid + '=0&anzb=' + x, 'uploadImages', 'status=yes,scrollbars=yes,height=500,width=350,left=300,top=50');
          Fenster.focus();
        }
      }
    //-->
    </script>


    php my Admin-Datenbanken: neu Eingetragen
    gesperrtes Bild

    So und Jetzt muss ich das ja noch in der: include/admin/gallery.php neu Eingetragen

    <?php
    #   Copyright by: Manuel
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    defined ('admin') or die ( 'only admin access' );
    
    
    require_once('include/includes/func/gallery.php');
    
    // START: Neu seit Ilch 1.1 Patchlevel 15
    	function image_valid($type) {
    		$file_types  = array(
    			'image/pjpeg'	=> 'jpg',
    			'image/jpeg'	=> 'jpg',
    			'image/jpeg'	=> 'jpeg',
    			'image/gif'		=> 'gif',
    			'image/X-PNG'	=> 'png',
    			'image/PNG'		=> 'png',
    			'image/png'		=> 'png',
    			'image/x-png'	=> 'png',
    			'image/JPG'		=> 'jpg',
    			'image/GIF'		=> 'gif',
    		);
    		
    		if ( !array_key_exists ( $type, $file_types ) ) {
    			return false;
    		} else {
    			return true;
    		}
    	}
    // END: Neu seit Ilch 1.1 Patchlevel 15
    
    function gallery_admin_showcats ( $id , $stufe ) {
        global $menu;
      $q = "SELECT * FROM prefix_gallery_cats WHERE cat = ".$id." ORDER BY pos";
    	$erg = db_query($q);
    	if ( db_num_rows($erg) > 0 ) {
     	  while ($row = db_fetch_object($erg) ) {
     	  if ($menu->getE('S') == $row->id) {
     	      $row->name = '<strong>'.$row->name.'</strong>';
     	  }
    	  echo '<tr class="Cmite"><td>'.$stufe.'- <a href="?gallery-S'.$row->id.'">'.$row->name.'</a></td>';
          echo '<td><a href="javascript:uploadImages('.$row->id.')"><img src="include/images/icons/upload.png" title="Bilder in diese Kategorie hochladen" alt="Bilder in diese Kategorie hochladen" border="0"></td>';
          echo '<td><a href="javascript:reloadImages('.$row->id.')"><img src="include/images/icons/reload.png" title="Bilder in diese Kategorie erneuern / einlesen" alt="Bilder in diese Kategorie erneuern / einlesen" border="0"></a></td>';
          echo '<td><a href="admin.php?gallery-E'.$row->id.'#edit"><img src="include/images/icons/edit.png" border="0" alt="&auml;ndern" title="&auml;ndern"></a></td>';
          echo '<td><a href="javascript:Kdel('.$row->id.')"><img src="include/images/icons/del.png" border="0" alt="l&ouml;schen" title="l&ouml;schen"></a></td>';
          echo '<td><a href="admin.php?gallery-M'.$row->id.'-o'.$row->pos.'"><img src="include/images/icons/pfeilo.png" border="0" title="hoch" alt="hoch"></a></td>';
          echo '<td><a href="admin.php?gallery-M'.$row->id.'-u'.$row->pos.'"><img src="include/images/icons/pfeilu.png" border="0" title="runter" alt="runter"></a></td></tr>';
    	  gallery_admin_showcats($row->id, $stufe.' &nbsp; &nbsp;' );
    	  }
    	}
    }
    
    function gallery_admin_selectcats ( $id, $stufe, &$output, $sel = 0) {
      $q = "SELECT * FROM prefix_gallery_cats WHERE cat = ".$id." ORDER BY pos";
    	$erg = db_query($q);
    	if ( db_num_rows($erg) > 0 ) {
     	  while ($row = db_fetch_object($erg) ) {
    	    $output .= '<option value="'.$row->id.'"'.($sel == $row->id?' selected="selected"':'').'>'.$stufe.' '.$row->name.'</option>';
          gallery_admin_selectcats($row->id, $stufe.'&raquo;', $output, $sel );
    	  }
    	}
    }
    
    # Bilder einer Kategorie erneuern oder einlesen
    if ( $menu->get(1) == 'reloadImages' ) {
      $msg = '';
      if (isset($_POST['do_aktion']) AND $_POST['do_aktion'] == 'yes') {
        # wenn keine aktion gewaehlt wurde
        if (empty($_POST['aktion'])) {
          $msg = 'Bitte eine Aktion ausw&auml;hlen<br />';
    
        # aktion alle bilder eines ordners einlesen
        } elseif ($_POST['aktion'] == 'ins') {
          if (is_dir($_POST['dir'])) {
            $msg .= 'Bilder aus Ordner '.$_POST['dir'].' eingefugt<br />';
            $o = opendir($_POST['dir']);
            while($f = readdir($o)) {
              if ($f == '.' OR $f == '..') { continue; }
              $imgpath = $_POST['dir'].'/'.$f;
              $size = getimagesize($imgpath);
              if ($size[2] == 2 OR $size[2] == 3) {
                $name = basename($imgpath);
                $tmp = explode('.',$name);
                $tm1 = count($tmp) -1;
                $endung = $tmp[$tm1];
                unset($tmp[$tm1]);
                $name = implode('',$tmp);
                $id = db_result(db_query("SHOW TABLE STATUS FROM `". DBDATE ."` LIKE 'prefix_gallery_imgs'"),0,'Auto_increment');
                $bild_url = 'include/images/gallery/img_'.$id.'.'.$endung;
                if (@copy ($imgpath,$bild_url)){
                  db_query("INSERT INTO prefix_gallery_imgs (cat,datei_name,endung,besch) VALUES (".$menu->get(2).",'".$name."','".$endung."','')");
                  $msg .= '- '.$imgpath.'<br />';
                  $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
                  $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
                  create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
                  create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
                }
              }
            }
          } else {
            $msg = 'Konnte den Ordner '.$_POST['dir'].' nicht finden<br />';
          }
    
        # aktion alle bilder erneuern mit oder ohne ueberschreiben
        } elseif ($_POST['aktion'] == 'alle' OR $_POST['aktion'] == 'alle_no') {
          $erg = db_query("SELECT id,endung FROM prefix_gallery_imgs WHERE cat = ".$menu->get(2));
          while ($r = db_fetch_assoc($erg)) {
            $endung = $r['endung'];
            $id     = $r['id'];
            $bild_url = 'include/images/gallery/img_'.$id.'.'.$endung;
            if (file_exists ($bild_url)) {
              $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
              $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
              if ($_POST['aktion'] == 'alle' OR !file_exists($bild_thumb)) {
                create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
              }
              if ($_POST['aktion'] == 'alle' OR !file_exists($bild_norm)) {
                create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
              }
            }
          }
    
          if ($_POST['aktion'] == 'alle') {
            $msg = 'Alle Bilder erneuert';
          } else {
            $msg = 'Alle Bilder erneuert, nicht &uuml;berschrieben';
          }
        }
      }
    
      # anzeigen
      $tpl = new tpl ( 'gallery/images_reload', 1);
      $cname = 'keine Kategorie';
      if ($menu->get(2) > 0) {
        $cname = db_result(db_query("SELECT name FROM prefix_gallery_cats WHERE id = ".$menu->get(2)),0,0);
      }
      $tpl->set('cat', $menu->get(2) );
      $tpl->set('cname',$cname);
      $tpl->set('msg', $msg);
      $tpl->out(0);
      exit();
    }
    
    # Bilder in eine Kategorie hochladen
    if ( $menu->get(1) == 'uploadImages' ) {
      $msg = '';
      if (isset($_POST['hochladen']) AND $_POST['hochladen'] == 'yes') {
        foreach ($_FILES['file']['name'] AS $k => $v) {
          if (!empty($_FILES['file']['name'][$k])) {
            $name = $_FILES['file']['name'][$k];
            $tmp = explode('.',$name);
            $tm1 = count($tmp) -1;
            $endung = $tmp[$tm1];
            unset($tmp[$tm1]);
            $name = implode('',$tmp);
            $besch = escape($_POST['besch'][$k],'string');
            $id = db_result(db_query("SHOW TABLE STATUS FROM `". DBDATE ."` LIKE 'prefix_gallery_imgs'"),0,'Auto_increment');
            $bild_url = 'include/images/gallery/img_'.$id.'.'.$endung;
    		
    		// START: Geändert seit Ilch 1.1 Patchlevel 15
    			if( image_valid ( $_FILES['file']['type'][$k] ) ) {
    				if (@move_uploaded_file ($_FILES['file']['tmp_name'][$k], $bild_url)) {
    				  @chmod($bild_url, 0777);
    				  db_query("INSERT INTO prefix_gallery_imgs (cat,datei_name,endung,besch) VALUES (".$menu->get(2).",'".$name."','".$endung."','".$besch."')");
    				  $msg .= 'Datei '.$name.'.'.$endung.' erfolgreich hochgeladen<br />';
    				  $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
    				  $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
    				  create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
    				  @chmod($bild_thumb, 0777);
    				  create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
    				  @chmod($bild_norm, 0777);
    				} else {
    				  $msg .= 'Datei '.$name.'.'.$endung.' konnte nicht hochgeladen werden<br />';
    				}
    			} else {
    				$msg .= 'Falsches Dateiformat';
    			}
    		// END: Geändert seit Ilch 1.1 Patchlevel 15
    
          }
        }
      }
      # bilder hochladen
    
      $anzb = 5;
      if (isset($_GET['anzb']) AND is_numeric($_GET['anzb'])) {
        $anzb = $_GET['anzb'];
      }
      $tpl = new tpl ( 'gallery/images_upload', 1);
      $tpl->set('cat', $menu->get(2) );
      $tpl->set('msg', $msg);
      $tpl->out(0);
      $class = 'Cmite';
      for($i=1;$i<=$anzb;$i++) {
        $tpl->set('class', ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' ) );
        $tpl->out(1);
      }
      $tpl->out(2);
      exit();
    }
    
    # Kategorie löschen
    if ( $menu->getA(1) == 'D' ) {
    
        $tpl = new tpl('gallery/delkat', 1);
        $tpl->out(0);
        //Kategorie und alle Bilder löschen
        if ($menu->get(2) == 'delall') {
            $r = db_fetch_assoc(db_query("SELECT id, pos, cat FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'"));
            db_query("DELETE FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$r['pos']." AND cat = ".$r['cat']);
            $sql = db_query("SELECT * FROM prefix_gallery_imgs WHERE cat = '{$r['id']}'");
            while($r2 = db_fetch_assoc($sql)){
                @unlink ('include/images/gallery/img_'.$r2['id'].'.'.$r2['endung']);
                @unlink ('include/images/gallery/img_thumb_'.$r2['id'].'.'.$r2['endung']);
                @unlink ('include/images/gallery/img_norm_'.$r2['id'].'.'.$r2['endung']);
            }
            db_query("DELETE FROM prefix_gallery_imgs WHERE cat = '".$r['id']."'");
            echo 'Kategorie und Bilder gel&ouml;scht<br />';
            $tpl->out(2);
        } elseif ($menu->get(2) == 'delkat') {
            $r = db_fetch_assoc(db_query("SELECT id, pos, cat FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'"));
            db_query("DELETE FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$r['pos']." AND cat = ".$r['cat']);
            db_query("DELETE FROM prefix_gallery_imgs WHERE cat = '".$r['id']."'");
            echo 'Nur Kategorie gel&ouml;scht, Bilder noch auf dem FTP<br />';
            $tpl->out(2);
        } elseif (isset($_POST['move']) AND $_POST['cat'] != $menu->getE(1)) {
        	$_POST['cat'] = escape($_POST['cat'], 'integer');
            $r = db_fetch_assoc(db_query("SELECT id, pos, cat FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'"));
            db_query("DELETE FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$r['pos']." AND cat = ".$r['cat']);
            db_query("UPDATE prefix_gallery_imgs set cat = '{$_POST['cat']}' WHERE cat = '".$r['id']."'");
            echo 'Bilder in Kategorie "'.@db_result(db_query("SELECT name FROM prefix_gallery_cats WHERE id = '{$_POST['cat']}'"),0).'" verschoben und alte Kategorie gel&ouml;scht.<br />';
            $tpl->out(2);
        } else {
            $row = array('id' => $menu->getE(1));
            gallery_admin_selectcats('0','',$row['cats'],$row['cats']);
            $row['cats'] = '<option value="0">Keine</option>'.$row['cats'];
            $tpl->set_ar_out($row,1);
        }
        $tpl->out(3);
        exit();
    }
    
    #Bilder verschieben
    if (isset($_POST['movepics'])) {
        if (count($_POST['img']) > 0) {
            $pics = implode(',',$_POST['img']);
            $cat = escape($_POST['movecat'],'integer');
            db_query("UPDATE prefix_gallery_imgs SET cat = $cat WHERE id IN ($pics);");
            $menu->set_url(1,'S'.$cat);
        }
    }
    
    $design = new design ( 'Admins Area', 'Admins Area', 2 );
    $design->header();
    $tpl = new tpl ( 'gallery/gallery', 1);
    
    # Bild loeschen
    if ( $menu->getA(1) == 'd' ) {
      $id = $menu->getE(1);
      $row = db_fetch_assoc(db_query("SELECT endung,cat FROM prefix_gallery_imgs WHERE id = ".$id));
      $endung = $row['endung'];
      @unlink ('include/images/gallery/img_'.$id.'.'.$endung);
      @unlink ('include/images/gallery/img_thumb_'.$id.'.'.$endung);
      @unlink ('include/images/gallery/img_norm_'.$id.'.'.$endung);
      db_query("DELETE FROM prefix_gallery_imgs WHERE id = ".$id);
      $azk = $row['cat'];
    }
    
    # Bild Beschreibung aendern
    if ( $menu->getA(1) == 'e' ) {
      $id = $menu->getE(1);
      $besch = escape($_REQUEST['besch'],'string');
      $row = db_fetch_assoc(db_query("SELECT cat FROM prefix_gallery_imgs WHERE id = ".$id));
      db_query("UPDATE prefix_gallery_imgs SET besch = '".$besch."' WHERE id = ".$id);
      $azk = $row['cat'];
    }
    
    # Bild erneuern
    if ( $menu->getA(1) == 'r' ) {
      $id         = $menu->getE(1);
      $row        = db_fetch_assoc(db_query("SELECT endung,cat FROM prefix_gallery_imgs WHERE id = ".$id));
      $endung     = $row['endung'];
      $bild_url   = 'include/images/gallery/img_'.$id.'.'.$endung;
      if (file_exists ($bild_url)) {
        $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
        $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
        create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
        create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
      }
      $azk = $row['cat'];
    }
    
    if ($menu->getA(1) == 'M') {
      $pos = $menu->getE(2);
      $id = $menu->getE(1);
      $cat = db_result(db_query("SELECT cat FROM prefix_gallery_cats WHERE id = ".$id),0);
      $nps = ( $menu->getA(2) == 'u' ? $pos + 1 : $pos - 1 );
      $anz = db_result(db_query("SELECT COUNT(*) FROM prefix_gallery_cats WHERE cat = ".$cat),0);
    
      if ($nps < 0) {
        db_query("UPDATE prefix_gallery_cats SET pos = ".$anz." WHERE id = ".$id);
        db_query("UPDATE prefix_gallery_cats SET pos = pos -1 WHERE cat = ".$cat);
      }
      if ($nps >= $anz) {
        db_query("UPDATE prefix_gallery_cats SET pos = -1 WHERE id = ".$id);
        db_query("UPDATE prefix_gallery_cats SET pos = pos +1 WHERE cat = ".$cat);
      }
    
      if ( $nps < $anz AND $nps >= 0 ) {
        db_query("UPDATE prefix_gallery_cats SET pos = ".$pos." WHERE pos = ".$nps." AND cat = ".$cat);
        db_query("UPDATE prefix_gallery_cats SET pos = ".$nps." WHERE id = ".$id);
      }
    }
    
    # kategorie eintrage speichern oder aendern.
    if ( isset ( $_POST['Csub']) ) {
      if ( empty($_POST['Ccat']) ) {
    	  $_POST['Ccat'] = 0;
    	}
    	if ( empty ($_POST['Cpkey']) ) {
        $nextpos = db_result(db_query("SELECT COUNT(*) FROM prefix_gallery_cats WHERE cat = ".$_POST['Ccat']),0,0);
        db_query("INSERT INTO prefix_gallery_cats (`cat`,`name`,`besch`,pos,recht) VALUES (".$_POST['Ccat'].",'".$_POST['Cname']."','".$_POST['Cdesc']."','".$nextpos."',".$_POST['Crecht'].")");
    	} else {
        $r = db_fetch_assoc(db_query("SELECT cat, pos FROM prefix_gallery_cats WHERE id = ".$_POST['Cpkey']));
    
        $bool = true;
        $tc = $_POST['Ccat'];
        while ($tc > 0) {
        if ($tc == $_POST['Cpkey']) { $bool = false; }
        $tc = @db_result(db_query("SELECT cat FROM prefix_gallery_cats WHERE id = $tc"));
        }
        if ($bool) {
          $epos = $r['pos'];
          $akc  = $r['cat'];
          $npos = $epos;
          if ($akc != $_POST['Ccat']) {
            $npos = db_result(db_query("SELECT COUNT(*) FROM prefix_gallery_cats WHERE cat = ".$_POST['Ccat']),0,0);
          }
      	  db_query("UPDATE prefix_gallery_cats SET `cat` = '".$_POST['Ccat']."',pos=".$npos.",recht=".$_POST['Crecht'].",`name` = '".$_POST['Cname']."',`besch` = '".$_POST['Cdesc']."' WHERE `id` = '".$_POST['Cpkey']."'");
          if ($akc != $_POST['Ccat']) {
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$epos." AND cat = ".$akc);
          }
        }
    	}
      $azk = $_POST['Ccat'];
    }
    
        if ( !isset($azk) ) {
          $azk = 0;
          if ( $menu->getA(1) == 'S' OR $menu->getA(1) == 'E' ) {
            $azk = $menu->getE(1);
          }
        }
    
        $tpl->out(0); $class = 0;
        $abf = "SELECT id,besch,datei_name,endung FROM prefix_gallery_imgs WHERE cat = ".$azk;
        $erg = db_query($abf);
        $i = 0;
        while ($row = db_fetch_assoc($erg) ) {
    		  $class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
          $row['class'] = $class;
          if ( $i <> 0 AND ($i % $allgAr['gallery_imgs_per_line'] ) == 0 ) { echo '</tr><tr>'; }
          $tpl->set_ar_out($row,1);
          $i++;
        }
    
        # links
        $tpl->out(2);
        # cat
        if ( $menu->getA(1) == 'E' ) {
          $erg = db_query("SELECT id,cat as Ccat, recht as Crecht, name as Cname,pos as Cpos,`besch` as Cdesc FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
    		  $_Cilch = db_fetch_assoc($erg);
    			$_Cilch['Cpkey'] = $menu->getE(1);
    		} else {
    		  $_Cilch = array (
    			  'Ccat' => '',
    				'Cpkey' => '',
    				'Cpos' => '',
    				'Cname' => '',
            'Crecht' => '',
    				'Cdesc' => ''
    			);
    		}
        #$_Cilch['Crecht'] = arlistee($_Cilch['Crecht'],getFuerAr());
    	  gallery_admin_selectcats('0','',$_Cilch['Ccat'],$_Cilch['Ccat']);
        $_Cilch['Ccat']   = '<option value="0">Keine</option>'.$_Cilch['Ccat'];
    		$_Cilch['Crecht'] = dblistee($_Cilch['Crecht'],"SELECT id,name FROM prefix_grundrechte ORDER BY id DESC");
        gallery_admin_showcats ( 0 , '' );
    
        $tpl->set_ar($_Cilch);
        $tpl->out(3);
    
    $design->footer();
    ?>


    MFG zwinker


    verwendete ilch Version: 1.1 P


    Zuletzt modifiziert von FightClub am 17.02.2014 - 12:26:15
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    holz Hall Of Fame
    Registriert seit
    17.11.2005
    Beiträge
    4.606
    Beitragswertungen
    117 Beitragspunkte
    was heißt du bekommst es nicht hin??? gibt es fehlermeldungen oder wo klemmts?
    0 Mitglieder finden den Beitrag gut.
  3. #3
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von holz
    was heißt du bekommst es nicht hin??? gibt es fehlermeldungen oder wo klemmts?


    Ich weiß nicht wie ich es in der gallery.php Einschreiben soll bin noch PHP Neulink zwinker
    0 Mitglieder finden den Beitrag gut.
  4. #4
    User Pic
    holz Hall Of Fame
    Registriert seit
    17.11.2005
    Beiträge
    4.606
    Beitragswertungen
    117 Beitragspunkte
    ja dann arbeite dich am besten ein dann weißt du gleich was da abgeht zwinker

    das hier wäre was das du brauchst:

    externer Link
    0 Mitglieder finden den Beitrag gut.
  5. #5
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von holz
    ja dann arbeite dich am besten ein dann weißt du gleich was da abgeht zwinker

    das hier wäre was das du brauchst:

    externer Link


    Ja Danke für deine Antwort,
    Aber ich verstehe nur Bahnhof nachdenken
    Das habe ich in der include/admin/News.php Gefunden das verweißt doch auf die Bilder in der News Kategorie oder?

    <?php
    // Copyright by: Manuel
    // Support: www.ilch.de
    defined ('main') or die ('no direct access');
    defined ('admin') or die ('only admin access');
    
    $design = new design ('Admins Area', 'Admins Area', 2);
    $design->header();
    // #
    // ##
    // ###
    // #### F u n k t i o n e n
    function getKats ($akt) {
        $katAR = array();
        $kats = '';
        $erg = db_query("SELECT DISTINCT news_kat FROM `prefix_news`");
        while ($row = db_fetch_object($erg)) {
            $katAr[] = $row->news_kat;
        }
        $katAr[] = 'Allgemein';
        $katAr = array_unique($katAr);
        foreach($katAr as $a) {
            if (trim($a) == trim($akt)) {
                $sel = ' selected';
            } else {
                $sel = '';
            }
            $kats .= '<option' . $sel . '>' . $a . '</option>';
        }
        return ($kats);
    }
    // #### F u n k t i o n
    // ###
    // ##
    // #
    
    
    // #
    // ##
    // ###
    // #### A k t i o n e n
    if (!empty($_REQUEST['um'])) {
        $um = $_REQUEST['um'];
    		$_POST['kat'] = escape($_POST['kat'], 'string');
    	$_POST['katLis'] = escape($_POST['katLis'], 'string');
    	if ($um == 'insert') {
            // insert
            if ($_POST['katLis'] == 'neu') {
                $_POST['katLis'] = $_POST['kat'];
            }
            db_query("INSERT INTO `prefix_news` (news_kat)
    		VALUES ('" . $_POST['katLis'] . "')");
            // insert
        } elseif ($um == 'change') {
            // edit
            $text = escape($_POST['txt'], 'textarea');
    
            if ($_POST['katLis'] == 'neu') {
                $_POST['katLis'] = $_POST['kat'];
            }
            db_query('UPDATE `prefix_news` SET
    				news_kat   = "' . $_POST['katLis'] . '");
        }
    }
    
    // #
    // ##
    // ###
    // #### h t m l   E i n g a b e n
    if (empty ($doNoIn)) {
        if ($menu->get(1) != 'edit') {
            $FkatLis = '';
    
        } else {
            $row = db_fetch_object(db_query("SELECT * FROM `prefix_news` WHERE news_id = " . $menu->get(2)));
            $FkatLis = $row->news_kat;
        }
        $tpl = new tpl ('news', 1);
    
        $ar = array
        (
    
            'KATS' => getKats($FkatLis),
    
    
            );
    
        $tpl->set_ar_out($ar, 0);
    
        $tpl->set_ar_out(array ('MPL' => $MPL) , 2);
    }
    
    $design->footer();
    
    ?>
    0 Mitglieder finden den Beitrag gut.
  6. #6
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ICH BITTE UM HILFE traurig

    ZitatZitat geschrieben von FightClub
    Admin Gallery mit Kategorien Bild


    Hallo alle ich hätte es gerne,
    wenn Mann in AdminBereich unter Gallery Kategorien ein Bild für die Kategorie hinzufügen kann.
    Aber ich bekomme es mit der gallery.php nicht hin.
    Ich Bitte um eure HILFE!

    Das Habe ich Hinbekommen. zwinker

    ilch Admin Gallery: include/admin/templates/gallery/gallery.htm

    gesperrtes Bild

    Meine: include/admin/templates/gallery/gallery.htm
    <table border="0" class="border" cellspacing="1" cellpadding="9">
     <tr>
      <td class="Chead" colspan="1">
       <font color="#FFFFFF">
    	<img src="include/images/icons/admin/gallery.png" width="16" height="16" /> &nbsp; Gallery
       </font>
      </td>
     </tr>
     <tr>
      <td align="left" class="Cnorm">
      
    <form action="admin.php?gallery" method="POST">
    <table width="100%">
      <tr>
    	  <td valign="top" width="60%" rowspan="2">
    
          <table cellpadding="3" border="0" cellspacing="5" class="border">
            <tr>
            {EXPLODE}
            <td class="{class}" valign="top">
              <table cellpadding="2" border="0" cellspacing="1" class="border">
                <tr>
                  <td valign="top" class="{class}">
    
              <table cellpadding="1" border="0" cellspacing="0" class="border">
                <tr>
                  <td class="Cmite"><a href="javascript:del({id})"><img src="include/images/icons/del.png" border="0" title="l&ouml;schen" alt="l&ouml;schen"></a></td>
                </tr><tr>
                  <td class="Cnorm"><a href="javascript:edit('{besch}',{id})"><img src="include/images/icons/edit.png" title="&auml;ndern" border="0" alt="&auml;ndern"></a></td>
                </tr><tr>
                  <td class="Cmite"><a href="javascript:reload({id})"><img src="include/images/icons/reload.png" border="0" title="erneuern" alt="erneuern"></a></td>
                </tr><tr>
                  <td class="Cnorm"><input type="checkbox" name="img[]" value="{id}" style="margin:0px; padding: 0px;" title="Bild f&uuml;r Verschieben markieren" /></td>
                </tr>
              </table>
                  </td><td valign="top" class="{class}">
                    <img title="{datei_name} |---| {besch}" alt="{datei_name}" src="include/images/gallery/img_thumb_{id}.{endung}" />
                  </td>
                </tr>
              </table>
            </td>
            {EXPLODE}
            </tr>
          </table>
        </td>
        <td valign="top" width="40%">
    
    <table cellpadding="3" border="0" cellspacing="1" class="border">
      <tr class="Chead">
    		<td colspan="9"><b>Kategorien</b></td>
      </tr><tr class="Cmite">
        <td><a href="?gallery-S0">Keine</a></td>
        <td><a href="javascript:uploadImages(0)"><img src="include/images/icons/upload.png" title="Bilder in diese Kategorie hochladen" alt="Bilder in diese Kategorie hochladen" border="0"></a></td>
        <td><a href="javascript:reloadImages(0)"><img src="include/images/icons/reload.png" title="Bilder in diese Kategorie erneuern / einlesen" alt="Bilder in diese Kategorie erneuern / einlesen" border="0"></a></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>{EXPLODE}
    </table>
    <br />
    <table cellpadding="3" border="0" cellspacing="1" class="border">
      <tr class="Chead">
    		<td colspan="9"><b>Bilder verschieben</b></td>
      </tr><tr class="Cmite"><td>nach:</td><td><select name="movecat">{Ccat}</select></td>
      </tr><tr class="Cdark">
            <td colspan="2"><input type="submit" value="markierte Bilder verschieben" name="movepics" /></td>
      </tr>
    </table>
    <br />
    	<input type="hidden" name="Cpkey" value="{Cpkey}">
    
    	<table class="border" cellpadding="3" cellspacing="1" border="0">
        <tr class="Chead">
    		  <td colspan="2"><b>Gallery Kategorien</b></td>
    		</tr>
          <td class="Cmite">Kategorie</td>
    			<td class="Cnorm"><select name="Ccat">{Ccat}</select></td>
        </tr><tr>
          <td class="Cmite">Kategorie Bild :</td>
          <td class="Cnorm"><select onChange="sichtbar()" name="katLis">{KATS}<option value="neu">Neu:</option></select>&nbsp;&nbsp;<input type="text" name="kat" size="40"></td>
        </tr><tr>
          <td class="Cmite">Sichtbar&nbsp;ab</td>
    			<td class="Cnorm"><select name="Crecht">{Crecht}</select></td>
        </tr><tr>
          <td class="Cmite">Name</td>
    			<td class="Cnorm"><input type="text" name="Cname" value="{Cname}" /></td>
        </tr><tr>
          <td class="Cmite">Beschreibung</td>
    			<td class="Cnorm"><textarea cols="30" rows="3" name="Cdesc">{Cdesc}</textarea></td>
        </tr>
    		<tr class="Cdark">
    		  <td></td>
    			<td><input type="submit" value="Absenden" name="Csub" /></td>
    		</tr>
      </table>
    </form>
    
    </td></td></table>
    
      </td>
     </tr>
    </table>
    
    <script language="JavaScript" type="text/javascript">
    <!--
    
      function Kdel ( id1 ) {
        var Fenster = window.open ('admin.php?gallery-D' + id1, 'delKat', 'status=yes,scrollbars=yes,height=150,width=550,left=300,top=50');
        Fenster.focus();
      }
      function del ( id1 ) {
        var x = confirm ( "Dieses Bild wirklich löschen?" );
    		if ( x ) {
    		  document.location.href="?gallery-d"+id1;
    		}
    	}
      function edit ( besch, id1 ) {
        var x = prompt ( "Bitte die neue Beschreibung eingeben!", besch);
        if ( x ) {
          document.location.href="?gallery-e"+id1+"=0&besch=" + x;
        }
      }
      function reload ( id1 ) {
        var x = confirm ( "Dieses Bild wirklich erneuern?" );
        if ( x ) {
          document.location.href="?gallery-r"+id1;
        }
      }
      function reloadImages (kid) {
        var Fenster = window.open ('admin.php?gallery-reloadImages-' + kid, 'reloadImages', 'status=yes,scrollbars=yes,height=500,width=350,left=300,top=50');
        Fenster.focus();
      }
      function uploadImages (kid) {
        var x = prompt ( "Wie viele Bilder möchten Sie hochladen?", "5");
        if ( x ) {
          var Fenster = window.open ('admin.php?gallery-uploadImages-' + kid + '=0&anzb=' + x, 'uploadImages', 'status=yes,scrollbars=yes,height=500,width=350,left=300,top=50');
          Fenster.focus();
        }
      }
    //-->
    </script>


    php my Admin-Datenbanken: neu Eingetragen
    gesperrtes Bild

    So und Jetzt muss ich das ja noch in der: include/admin/gallery.php neu Eingetragen
    Aber was muss da Rein???

    <?php
    #   Copyright by: Manuel
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    defined ('admin') or die ( 'only admin access' );
    
    
    require_once('include/includes/func/gallery.php');
    
    // START: Neu seit Ilch 1.1 Patchlevel 15
    	function image_valid($type) {
    		$file_types  = array(
    			'image/pjpeg'	=> 'jpg',
    			'image/jpeg'	=> 'jpg',
    			'image/jpeg'	=> 'jpeg',
    			'image/gif'		=> 'gif',
    			'image/X-PNG'	=> 'png',
    			'image/PNG'		=> 'png',
    			'image/png'		=> 'png',
    			'image/x-png'	=> 'png',
    			'image/JPG'		=> 'jpg',
    			'image/GIF'		=> 'gif',
    		);
    		
    		if ( !array_key_exists ( $type, $file_types ) ) {
    			return false;
    		} else {
    			return true;
    		}
    	}
    // END: Neu seit Ilch 1.1 Patchlevel 15
    
    function gallery_admin_showcats ( $id , $stufe ) {
        global $menu;
      $q = "SELECT * FROM prefix_gallery_cats WHERE cat = ".$id." ORDER BY pos";
    	$erg = db_query($q);
    	if ( db_num_rows($erg) > 0 ) {
     	  while ($row = db_fetch_object($erg) ) {
     	  if ($menu->getE('S') == $row->id) {
     	      $row->name = '<strong>'.$row->name.'</strong>';
     	  }
    	  echo '<tr class="Cmite"><td>'.$stufe.'- <a href="?gallery-S'.$row->id.'">'.$row->name.'</a></td>';
          echo '<td><a href="javascript:uploadImages('.$row->id.')"><img src="include/images/icons/upload.png" title="Bilder in diese Kategorie hochladen" alt="Bilder in diese Kategorie hochladen" border="0"></td>';
          echo '<td><a href="javascript:reloadImages('.$row->id.')"><img src="include/images/icons/reload.png" title="Bilder in diese Kategorie erneuern / einlesen" alt="Bilder in diese Kategorie erneuern / einlesen" border="0"></a></td>';
          echo '<td><a href="admin.php?gallery-E'.$row->id.'#edit"><img src="include/images/icons/edit.png" border="0" alt="&auml;ndern" title="&auml;ndern"></a></td>';
          echo '<td><a href="javascript:Kdel('.$row->id.')"><img src="include/images/icons/del.png" border="0" alt="l&ouml;schen" title="l&ouml;schen"></a></td>';
          echo '<td><a href="admin.php?gallery-M'.$row->id.'-o'.$row->pos.'"><img src="include/images/icons/pfeilo.png" border="0" title="hoch" alt="hoch"></a></td>';
          echo '<td><a href="admin.php?gallery-M'.$row->id.'-u'.$row->pos.'"><img src="include/images/icons/pfeilu.png" border="0" title="runter" alt="runter"></a></td></tr>';
    	  gallery_admin_showcats($row->id, $stufe.' &nbsp; &nbsp;' );
    	  }
    	}
    }
    
    function gallery_admin_selectcats ( $id, $stufe, &$output, $sel = 0) {
      $q = "SELECT * FROM prefix_gallery_cats WHERE cat = ".$id." ORDER BY pos";
    	$erg = db_query($q);
    	if ( db_num_rows($erg) > 0 ) {
     	  while ($row = db_fetch_object($erg) ) {
    	    $output .= '<option value="'.$row->id.'"'.($sel == $row->id?' selected="selected"':'').'>'.$stufe.' '.$row->name.'</option>';
          gallery_admin_selectcats($row->id, $stufe.'&raquo;', $output, $sel );
    	  }
    	}
    }
    
    # Bilder einer Kategorie erneuern oder einlesen
    if ( $menu->get(1) == 'reloadImages' ) {
      $msg = '';
      if (isset($_POST['do_aktion']) AND $_POST['do_aktion'] == 'yes') {
        # wenn keine aktion gewaehlt wurde
        if (empty($_POST['aktion'])) {
          $msg = 'Bitte eine Aktion ausw&auml;hlen<br />';
    
        # aktion alle bilder eines ordners einlesen
        } elseif ($_POST['aktion'] == 'ins') {
          if (is_dir($_POST['dir'])) {
            $msg .= 'Bilder aus Ordner '.$_POST['dir'].' eingefugt<br />';
            $o = opendir($_POST['dir']);
            while($f = readdir($o)) {
              if ($f == '.' OR $f == '..') { continue; }
              $imgpath = $_POST['dir'].'/'.$f;
              $size = getimagesize($imgpath);
              if ($size[2] == 2 OR $size[2] == 3) {
                $name = basename($imgpath);
                $tmp = explode('.',$name);
                $tm1 = count($tmp) -1;
                $endung = $tmp[$tm1];
                unset($tmp[$tm1]);
                $name = implode('',$tmp);
                $id = db_result(db_query("SHOW TABLE STATUS FROM `". DBDATE ."` LIKE 'prefix_gallery_imgs'"),0,'Auto_increment');
                $bild_url = 'include/images/gallery/img_'.$id.'.'.$endung;
                if (@copy ($imgpath,$bild_url)){
                  db_query("INSERT INTO prefix_gallery_imgs (cat,datei_name,endung,besch) VALUES (".$menu->get(2).",'".$name."','".$endung."','')");
                  $msg .= '- '.$imgpath.'<br />';
                  $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
                  $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
                  create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
                  create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
                }
              }
            }
          } else {
            $msg = 'Konnte den Ordner '.$_POST['dir'].' nicht finden<br />';
          }
    
        # aktion alle bilder erneuern mit oder ohne ueberschreiben
        } elseif ($_POST['aktion'] == 'alle' OR $_POST['aktion'] == 'alle_no') {
          $erg = db_query("SELECT id,endung FROM prefix_gallery_imgs WHERE cat = ".$menu->get(2));
          while ($r = db_fetch_assoc($erg)) {
            $endung = $r['endung'];
            $id     = $r['id'];
            $bild_url = 'include/images/gallery/img_'.$id.'.'.$endung;
            if (file_exists ($bild_url)) {
              $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
              $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
              if ($_POST['aktion'] == 'alle' OR !file_exists($bild_thumb)) {
                create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
              }
              if ($_POST['aktion'] == 'alle' OR !file_exists($bild_norm)) {
                create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
              }
            }
          }
    
          if ($_POST['aktion'] == 'alle') {
            $msg = 'Alle Bilder erneuert';
          } else {
            $msg = 'Alle Bilder erneuert, nicht &uuml;berschrieben';
          }
        }
      }
    
      # anzeigen
      $tpl = new tpl ( 'gallery/images_reload', 1);
      $cname = 'keine Kategorie';
      if ($menu->get(2) > 0) {
        $cname = db_result(db_query("SELECT name FROM prefix_gallery_cats WHERE id = ".$menu->get(2)),0,0);
      }
      $tpl->set('cat', $menu->get(2) );
      $tpl->set('cname',$cname);
      $tpl->set('msg', $msg);
      $tpl->out(0);
      exit();
    }
    
    # Bilder in eine Kategorie hochladen
    if ( $menu->get(1) == 'uploadImages' ) {
      $msg = '';
      if (isset($_POST['hochladen']) AND $_POST['hochladen'] == 'yes') {
        foreach ($_FILES['file']['name'] AS $k => $v) {
          if (!empty($_FILES['file']['name'][$k])) {
            $name = $_FILES['file']['name'][$k];
            $tmp = explode('.',$name);
            $tm1 = count($tmp) -1;
            $endung = $tmp[$tm1];
            unset($tmp[$tm1]);
            $name = implode('',$tmp);
            $besch = escape($_POST['besch'][$k],'string');
            $id = db_result(db_query("SHOW TABLE STATUS FROM `". DBDATE ."` LIKE 'prefix_gallery_imgs'"),0,'Auto_increment');
            $bild_url = 'include/images/gallery/img_'.$id.'.'.$endung;
    		
    		// START: Geändert seit Ilch 1.1 Patchlevel 15
    			if( image_valid ( $_FILES['file']['type'][$k] ) ) {
    				if (@move_uploaded_file ($_FILES['file']['tmp_name'][$k], $bild_url)) {
    				  @chmod($bild_url, 0777);
    				  db_query("INSERT INTO prefix_gallery_imgs (cat,datei_name,endung,besch) VALUES (".$menu->get(2).",'".$name."','".$endung."','".$besch."')");
    				  $msg .= 'Datei '.$name.'.'.$endung.' erfolgreich hochgeladen<br />';
    				  $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
    				  $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
    				  create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
    				  @chmod($bild_thumb, 0777);
    				  create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
    				  @chmod($bild_norm, 0777);
    				} else {
    				  $msg .= 'Datei '.$name.'.'.$endung.' konnte nicht hochgeladen werden<br />';
    				}
    			} else {
    				$msg .= 'Falsches Dateiformat';
    			}
    		// END: Geändert seit Ilch 1.1 Patchlevel 15
    
          }
        }
      }
      # bilder hochladen
    
      $anzb = 5;
      if (isset($_GET['anzb']) AND is_numeric($_GET['anzb'])) {
        $anzb = $_GET['anzb'];
      }
      $tpl = new tpl ( 'gallery/images_upload', 1);
      $tpl->set('cat', $menu->get(2) );
      $tpl->set('msg', $msg);
      $tpl->out(0);
      $class = 'Cmite';
      for($i=1;$i<=$anzb;$i++) {
        $tpl->set('class', ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' ) );
        $tpl->out(1);
      }
      $tpl->out(2);
      exit();
    }
    
    # Kategorie löschen
    if ( $menu->getA(1) == 'D' ) {
    
        $tpl = new tpl('gallery/delkat', 1);
        $tpl->out(0);
        //Kategorie und alle Bilder löschen
        if ($menu->get(2) == 'delall') {
            $r = db_fetch_assoc(db_query("SELECT id, pos, cat FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'"));
            db_query("DELETE FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$r['pos']." AND cat = ".$r['cat']);
            $sql = db_query("SELECT * FROM prefix_gallery_imgs WHERE cat = '{$r['id']}'");
            while($r2 = db_fetch_assoc($sql)){
                @unlink ('include/images/gallery/img_'.$r2['id'].'.'.$r2['endung']);
                @unlink ('include/images/gallery/img_thumb_'.$r2['id'].'.'.$r2['endung']);
                @unlink ('include/images/gallery/img_norm_'.$r2['id'].'.'.$r2['endung']);
            }
            db_query("DELETE FROM prefix_gallery_imgs WHERE cat = '".$r['id']."'");
            echo 'Kategorie und Bilder gel&ouml;scht<br />';
            $tpl->out(2);
        } elseif ($menu->get(2) == 'delkat') {
            $r = db_fetch_assoc(db_query("SELECT id, pos, cat FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'"));
            db_query("DELETE FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$r['pos']." AND cat = ".$r['cat']);
            db_query("DELETE FROM prefix_gallery_imgs WHERE cat = '".$r['id']."'");
            echo 'Nur Kategorie gel&ouml;scht, Bilder noch auf dem FTP<br />';
            $tpl->out(2);
        } elseif (isset($_POST['move']) AND $_POST['cat'] != $menu->getE(1)) {
        	$_POST['cat'] = escape($_POST['cat'], 'integer');
            $r = db_fetch_assoc(db_query("SELECT id, pos, cat FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'"));
            db_query("DELETE FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$r['pos']." AND cat = ".$r['cat']);
            db_query("UPDATE prefix_gallery_imgs set cat = '{$_POST['cat']}' WHERE cat = '".$r['id']."'");
            echo 'Bilder in Kategorie "'.@db_result(db_query("SELECT name FROM prefix_gallery_cats WHERE id = '{$_POST['cat']}'"),0).'" verschoben und alte Kategorie gel&ouml;scht.<br />';
            $tpl->out(2);
        } else {
            $row = array('id' => $menu->getE(1));
            gallery_admin_selectcats('0','',$row['cats'],$row['cats']);
            $row['cats'] = '<option value="0">Keine</option>'.$row['cats'];
            $tpl->set_ar_out($row,1);
        }
        $tpl->out(3);
        exit();
    }
    
    #Bilder verschieben
    if (isset($_POST['movepics'])) {
        if (count($_POST['img']) > 0) {
            $pics = implode(',',$_POST['img']);
            $cat = escape($_POST['movecat'],'integer');
            db_query("UPDATE prefix_gallery_imgs SET cat = $cat WHERE id IN ($pics);");
            $menu->set_url(1,'S'.$cat);
        }
    }
    
    $design = new design ( 'Admins Area', 'Admins Area', 2 );
    $design->header();
    $tpl = new tpl ( 'gallery/gallery', 1);
    
    # Bild loeschen
    if ( $menu->getA(1) == 'd' ) {
      $id = $menu->getE(1);
      $row = db_fetch_assoc(db_query("SELECT endung,cat FROM prefix_gallery_imgs WHERE id = ".$id));
      $endung = $row['endung'];
      @unlink ('include/images/gallery/img_'.$id.'.'.$endung);
      @unlink ('include/images/gallery/img_thumb_'.$id.'.'.$endung);
      @unlink ('include/images/gallery/img_norm_'.$id.'.'.$endung);
      db_query("DELETE FROM prefix_gallery_imgs WHERE id = ".$id);
      $azk = $row['cat'];
    }
    
    # Bild Beschreibung aendern
    if ( $menu->getA(1) == 'e' ) {
      $id = $menu->getE(1);
      $besch = escape($_REQUEST['besch'],'string');
      $row = db_fetch_assoc(db_query("SELECT cat FROM prefix_gallery_imgs WHERE id = ".$id));
      db_query("UPDATE prefix_gallery_imgs SET besch = '".$besch."' WHERE id = ".$id);
      $azk = $row['cat'];
    }
    
    # Bild erneuern
    if ( $menu->getA(1) == 'r' ) {
      $id         = $menu->getE(1);
      $row        = db_fetch_assoc(db_query("SELECT endung,cat FROM prefix_gallery_imgs WHERE id = ".$id));
      $endung     = $row['endung'];
      $bild_url   = 'include/images/gallery/img_'.$id.'.'.$endung;
      if (file_exists ($bild_url)) {
        $bild_thumb = 'include/images/gallery/img_thumb_'.$id.'.'.$endung;
        $bild_norm  = 'include/images/gallery/img_norm_'.$id.'.'.$endung;
        create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
        create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
      }
      $azk = $row['cat'];
    }
    
    if ($menu->getA(1) == 'M') {
      $pos = $menu->getE(2);
      $id = $menu->getE(1);
      $cat = db_result(db_query("SELECT cat FROM prefix_gallery_cats WHERE id = ".$id),0);
      $nps = ( $menu->getA(2) == 'u' ? $pos + 1 : $pos - 1 );
      $anz = db_result(db_query("SELECT COUNT(*) FROM prefix_gallery_cats WHERE cat = ".$cat),0);
    
      if ($nps < 0) {
        db_query("UPDATE prefix_gallery_cats SET pos = ".$anz." WHERE id = ".$id);
        db_query("UPDATE prefix_gallery_cats SET pos = pos -1 WHERE cat = ".$cat);
      }
      if ($nps >= $anz) {
        db_query("UPDATE prefix_gallery_cats SET pos = -1 WHERE id = ".$id);
        db_query("UPDATE prefix_gallery_cats SET pos = pos +1 WHERE cat = ".$cat);
      }
    
      if ( $nps < $anz AND $nps >= 0 ) {
        db_query("UPDATE prefix_gallery_cats SET pos = ".$pos." WHERE pos = ".$nps." AND cat = ".$cat);
        db_query("UPDATE prefix_gallery_cats SET pos = ".$nps." WHERE id = ".$id);
      }
    }
    
    # kategorie eintrage speichern oder aendern.
    if ( isset ( $_POST['Csub']) ) {
      if ( empty($_POST['Ccat']) ) {
    	  $_POST['Ccat'] = 0;
    	}
    	if ( empty ($_POST['Cpkey']) ) {
        $nextpos = db_result(db_query("SELECT COUNT(*) FROM prefix_gallery_cats WHERE cat = ".$_POST['Ccat']),0,0);
        db_query("INSERT INTO prefix_gallery_cats (`cat`,`name`,`besch`,pos,recht) VALUES (".$_POST['Ccat'].",'".$_POST['Cname']."','".$_POST['Cdesc']."','".$nextpos."',".$_POST['Crecht'].")");
    	} else {
        $r = db_fetch_assoc(db_query("SELECT cat, pos FROM prefix_gallery_cats WHERE id = ".$_POST['Cpkey']));
    
        $bool = true;
        $tc = $_POST['Ccat'];
        while ($tc > 0) {
        if ($tc == $_POST['Cpkey']) { $bool = false; }
        $tc = @db_result(db_query("SELECT cat FROM prefix_gallery_cats WHERE id = $tc"));
        }
        if ($bool) {
          $epos = $r['pos'];
          $akc  = $r['cat'];
          $npos = $epos;
          if ($akc != $_POST['Ccat']) {
            $npos = db_result(db_query("SELECT COUNT(*) FROM prefix_gallery_cats WHERE cat = ".$_POST['Ccat']),0,0);
          }
      	  db_query("UPDATE prefix_gallery_cats SET `cat` = '".$_POST['Ccat']."',pos=".$npos.",recht=".$_POST['Crecht'].",`name` = '".$_POST['Cname']."',`besch` = '".$_POST['Cdesc']."' WHERE `id` = '".$_POST['Cpkey']."'");
          if ($akc != $_POST['Ccat']) {
            db_query("UPDATE prefix_gallery_cats SET pos = pos - 1 WHERE pos > ".$epos." AND cat = ".$akc);
          }
        }
    	}
      $azk = $_POST['Ccat'];
    }
    
        if ( !isset($azk) ) {
          $azk = 0;
          if ( $menu->getA(1) == 'S' OR $menu->getA(1) == 'E' ) {
            $azk = $menu->getE(1);
          }
        }
    
        $tpl->out(0); $class = 0;
        $abf = "SELECT id,besch,datei_name,endung FROM prefix_gallery_imgs WHERE cat = ".$azk;
        $erg = db_query($abf);
        $i = 0;
        while ($row = db_fetch_assoc($erg) ) {
    		  $class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
          $row['class'] = $class;
          if ( $i <> 0 AND ($i % $allgAr['gallery_imgs_per_line'] ) == 0 ) { echo '</tr><tr>'; }
          $tpl->set_ar_out($row,1);
          $i++;
        }
    
        # links
        $tpl->out(2);
        # cat
        if ( $menu->getA(1) == 'E' ) {
          $erg = db_query("SELECT id,cat as Ccat, recht as Crecht, name as Cname,pos as Cpos,`besch` as Cdesc FROM prefix_gallery_cats WHERE id = '".$menu->getE(1)."'");
    		  $_Cilch = db_fetch_assoc($erg);
    			$_Cilch['Cpkey'] = $menu->getE(1);
    		} else {
    		  $_Cilch = array (
    			  'Ccat' => '',
    				'Cpkey' => '',
    				'Cpos' => '',
    				'Cname' => '',
            'Crecht' => '',
    				'Cdesc' => ''
    			);
    		}
        #$_Cilch['Crecht'] = arlistee($_Cilch['Crecht'],getFuerAr());
    	  gallery_admin_selectcats('0','',$_Cilch['Ccat'],$_Cilch['Ccat']);
        $_Cilch['Ccat']   = '<option value="0">Keine</option>'.$_Cilch['Ccat'];
    		$_Cilch['Crecht'] = dblistee($_Cilch['Crecht'],"SELECT id,name FROM prefix_grundrechte ORDER BY id DESC");
        gallery_admin_showcats ( 0 , '' );
    
        $tpl->set_ar($_Cilch);
        $tpl->out(3);
    
    $design->footer();
    ?>


    MFG zwinker


    verwendete ilch Version: 1.1 P


    Zuletzt modifiziert von FightClub am 17.02.2014 - 12:26:15



    Zuletzt modifiziert von FightClub am 20.02.2014 - 11:55:58
    0 Mitglieder finden den Beitrag gut.
  7. #7
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    Ich verstehe nur Bahnhof nachdenken
    Das habe ich in der include/admin/News.php Gefunden das verweißt doch auf die Bilder in der News Kategorie oder?

    <?php
    // Copyright by: Manuel
    // Support: www.ilch.de
    defined ('main') or die ('no direct access');
    defined ('admin') or die ('only admin access');
    
    $design = new design ('Admins Area', 'Admins Area', 2);
    $design->header();
    // #
    // ##
    // ###
    // #### F u n k t i o n e n
    function getKats ($akt) {
        $katAR = array();
        $kats = '';
        $erg = db_query("SELECT DISTINCT news_kat FROM `prefix_news`");
        while ($row = db_fetch_object($erg)) {
            $katAr[] = $row->news_kat;
        }
        $katAr[] = 'Allgemein';
        $katAr = array_unique($katAr);
        foreach($katAr as $a) {
            if (trim($a) == trim($akt)) {
                $sel = ' selected';
            } else {
                $sel = '';
            }
            $kats .= '<option' . $sel . '>' . $a . '</option>';
        }
        return ($kats);
    }
    // #### F u n k t i o n
    // ###
    // ##
    // #
    
    
    // #
    // ##
    // ###
    // #### A k t i o n e n
    if (!empty($_REQUEST['um'])) {
        $um = $_REQUEST['um'];
    		$_POST['kat'] = escape($_POST['kat'], 'string');
    	$_POST['katLis'] = escape($_POST['katLis'], 'string');
    	if ($um == 'insert') {
            // insert
            if ($_POST['katLis'] == 'neu') {
                $_POST['katLis'] = $_POST['kat'];
            }
            db_query("INSERT INTO `prefix_news` (news_kat)
    		VALUES ('" . $_POST['katLis'] . "')");
            // insert
        } elseif ($um == 'change') {
            // edit
            $text = escape($_POST['txt'], 'textarea');
    
            if ($_POST['katLis'] == 'neu') {
                $_POST['katLis'] = $_POST['kat'];
            }
            db_query('UPDATE `prefix_news` SET
    				news_kat   = "' . $_POST['katLis'] . '");
        }
    }
    
    // #
    // ##
    // ###
    // #### h t m l   E i n g a b e n
    if (empty ($doNoIn)) {
        if ($menu->get(1) != 'edit') {
            $FkatLis = '';
    
        } else {
            $row = db_fetch_object(db_query("SELECT * FROM `prefix_news` WHERE news_id = " . $menu->get(2)));
            $FkatLis = $row->news_kat;
        }
        $tpl = new tpl ('news', 1);
    
        $ar = array
        (
    
            'KATS' => getKats($FkatLis),
    
    
            );
    
        $tpl->set_ar_out($ar, 0);
    
        $tpl->set_ar_out(array ('MPL' => $MPL) , 2);
    }
    
    $design->footer();
    
    ?>
    0 Mitglieder finden den Beitrag gut.
  8. #8
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    Ich danke euch, habe es hinbekommen

    Thema kann Geschlossen werden.

    MFG BennY zwinker
    0 Mitglieder finden den Beitrag gut.
  9. #9
    User Pic
    holz Hall Of Fame
    Registriert seit
    17.11.2005
    Beiträge
    4.606
    Beitragswertungen
    117 Beitragspunkte
    erledigt
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu Module und Modifikationen

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten