Ok dann hier nochmal die kompletten Dateien auf Basis von 1.1E:
include/admin/archiv.php <?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
defined ('admin') or die ( 'only admin access' );
function get_upload_linked ( $v ) {
$l = '';
$i = 1;
$erg = db_query("SELECT id, name FROM prefix_downloads WHERE url = '".$v."'");
if ( @db_num_rows($erg) > 0 ) {
while ( $r=db_fetch_assoc($erg) ) {
$l .= '[<a href="javascript:showDDetails('.$r['id'].')" title="'.$r['name'].'">'.$i.'</a>], ';
$i++;
}
}
return ( $l);
}
function uploadMoveFile_getdirlist ($f='include/downs/downloads',$list='<option value="/">/</option>') {
$o = opendir($f);
while($v = readdir($o)) {
if ( $v == '.' OR $v == '..' OR !is_dir($f .'/'. $v) ) { continue; }
$dirn = str_replace('include/downs/downloads/','', $f .'/'. $v );
$list .= '<option value="'.$dirn.'">'.$dirn.'</option>';
$list = uploadMoveFile_getdirlist ($f .'/'. $v , $list);
}
return ( $list );
}
function upload_getdirlist ($f='include/downs/downloads',$list='') {
$o = opendir($f);
while($v = readdir($o)) {
if ( $v == '.' OR $v == '..' OR !is_dir($f .'/'. $v) ) { continue; }
$dirn = str_replace('include/downs/downloads/','', $f .'/'. $v );
$list .= '<tr><td class="Cnorm"><a href="?archiv-downloads-upload=0&f='.$f.'/'.$v.'">'.$dirn.'</a></td></tr>';
$list = upload_getdirlist ($f .'/'. $v , $list);
}
return ( $list );
}
function get_downloads_ar ($ar=NULL,$f=NULL) {
if ( is_null ( $ar ) ) {
$ar = array();
}
if ( is_null ($f) ) {
$f = 'include/downs/downloads';
}
$o = opendir($f);
while ($v = readdir($o) ) {
if ( $v != '.' AND $v != '..' ) {
if ( is_dir ($f.'/'.$v ) ) {
$ar = get_downloads_ar ($ar, $f.'/'.$v );
} else {
$ar[$f.'/'.$v] = $v;
}
}
}
closedir($o);
return ($ar);
}
function archiv_downs_admin_showcats ( $id , $stufe ) {
$q = "SELECT id,name,pos,cat FROM prefix_downcats WHERE cat = ".$id." ORDER BY pos";
$erg = db_query($q);
if ( db_num_rows($erg) > 0 ) {
while ($row = db_fetch_object($erg) ) {
echo '<tr class="Cmite"><td>'.$stufe.'- <a href="admin.php?archiv-downloads-S'.$row->id.'">'.$row->name.'</a></td>';
echo '<td align="center"><a href="admin.php?archiv-downloads-E'.$row->id.'#edit"><img src="include/images/icons/edit.gif" border="0"></a></td>';
echo '<td align="center"><a href="javascript:Kdel('.$row->id.')"><img src="include/images/icons/del.gif" border="0"></a></td>';
echo '<td align="center"><a href="admin.php?archiv-downloads-S'.$row->id.'-O'.$row->id.'-'.$row->pos.'-'.$row->cat.'"><img src="include/images/icons/pfeilo.gif" border="0"></a></td>';
echo '<td align="center"><a href="admin.php?archiv-downloads-S'.$row->id.'-U'.$row->id.'-'.$row->pos.'-'.$row->cat.'"><img src="include/images/icons/pfeilu.gif" border="0"></a></td></tr>';
archiv_downs_admin_showcats($row->id, $stufe.' ' );
}
}
}
function archiv_links_admin_showcats ( $id , $stufe ) {
$q = "SELECT * FROM prefix_linkcats WHERE cat = ".$id." ORDER BY pos";
$erg = db_query($q);
if ( db_num_rows($erg) > 0 ) {
while ($row = db_fetch_object($erg) ) {
echo '<tr class="Cmite"><td>'.$stufe.'- <a href="admin.php?archiv-links-S'.$row->id.'">'.$row->name.'</a></td>';
echo '<td align="center"><a href="?archiv-links-E'.$row->id.'#edit"><img src="include/images/icons/edit.gif" border="0"></a></td>';
echo '<td align="center"><a href="javascript:Kdel('.$row->id.')"><img src="include/images/icons/del.gif" border="0"></a></td>';
echo '<td align="center"><a href="admin.php?archiv-links-S'.$row->id.'-O'.$row->id.'-'.$row->pos.'-'.$row->cat.'"><img src="include/images/icons/pfeilo.gif" border="0"></a></td>';
echo '<td align="center"><a href="admin.php?archiv-links-S'.$row->id.'-U'.$row->id.'-'.$row->pos.'-'.$row->cat.'"><img src="include/images/icons/pfeilu.gif" border="0"></a></td></tr>';
archiv_links_admin_showcats($row->id, $stufe.' ' );
}
}
}
$um = $menu->get(1);
switch ($um) {
case 'downloads' :
if ( $menu->get(2) == 'upload' ) {
$msg = '';
# file rechte pruefen
if ( !is_writeable ( 'include/downs/downloads' ) ) {
$msg = '<b>Bevor du hier eine Datei hochladen/verwalten kannst muss der Ordner include/downs/<b>downloads</b>/ erstellt werden und er muss Schreibrechte ( chmod 777 ) erhalten !!! Wenn das geschehen ist einfach nochmal hier auf aktualisieren klicken</b>';
}
# Datei von anderem Server laden
if ( $menu->get(3) == 'url' ) {
$url = $_POST['url'];
$filename = strrchr($url, '/');
$directory = $_POST['f'];
if ((substr($url,0,7) == 'http://' ) OR (substr($url,0,6) == 'ftp://' )){
//Filedownload
if (ini_get('allow_url_fopen') == 1) {
$rh = @fopen($url, 'r');
if ($rh) {
$wh = fopen($directory.$filename, 'w+');
while (!feof($rh)) {
fwrite($wh, fgets($rh, 4096) ,4096);
}
fclose($wh);
fclose($rh);
}
else $msg = 'Die Datei existiert nicht!';
}
else $msg = 'PHP mit aktiviertem allow_url_open notwendig';
}
else $msg = 'Das war keine Internetadresse, beginnen sie bitte mit http:// oder ftp://';
}
# file hochladen
if ( isset ($_FILES['file']['name']) ) {
if ( move_uploaded_file ( $_FILES['file']['tmp_name'], $_REQUEST['f'].'/'.$_FILES['file']['name']) ) {
$msg = 'Datei ('.$_FILES['file']['name'].' ) <font color="#00FF00">erfolgreich hochgeladen</font><br />';
} else {
$msg = 'Datei ( '.$_FILES['file']['name'].' ) <font color="#FF0000">nicht erfolgreich hochgeladen</font><br />';
}
}
# datei loeschen
if ( isset ($_REQUEST['d']) ) {
unlink ( $_REQUEST['f'].'/'.$_REQUEST['d'] );
}
# datei verschieben
if ( isset ($_REQUEST['r']) ) {
if ( @rename ( $_REQUEST['f'].'/'.$_REQUEST['v'], $_REQUEST['f'].'/'.$_REQUEST['r'] ) ) {
db_query("UPDATE prefix_downloads SET url = '".$_REQUEST['f'].'/'.$_REQUEST['r']."' WHERE url = '".$_REQUEST['f'].'/'.$_REQUEST['v']."'");
db_query("UPDATE prefix_downloads SET surl = '".$_REQUEST['f'].'/'.$_REQUEST['r']."' WHERE surl = '".$_REQUEST['f'].'/'.$_REQUEST['v']."'");
db_query("UPDATE prefix_downloads SET ssurl = '".$_REQUEST['f'].'/'.$_REQUEST['r']."' WHERE ssurl = '".$_REQUEST['f'].'/'.$_REQUEST['v']."'");
$msg = '<font color="#00FF00">Erfolgreich umbenannt...</font><br />';
} else {
$msg = '<font color="#FF0000">Konnte Datei nicht umbennen</font></br />';
}
}
if ( isset ($_REQUEST['n']) ) {
$neudir = 'include/downs/downloads/'.str_replace('.','',$_REQUEST['n']);
if ( $_REQUEST['n'] == '/' ) {
$neudir = 'include/downs/downloads';
}
if ( is_dir ( $neudir ) AND is_writeable ( $neudir ) ) {
if ( @rename ( $_REQUEST['f'].'/'.$_REQUEST['v'], $neudir.'/'.$_REQUEST['v'] ) ) {
db_query("UPDATE prefix_downloads SET url = '".$neudir.'/'.$_REQUEST['v']."' WHERE url = '".$_REQUEST['f'].'/'.$_REQUEST['v']."'");
db_query("UPDATE prefix_downloads SET surl = '".$neudir.'/'.$_REQUEST['v']."' WHERE surl = '".$_REQUEST['f'].'/'.$_REQUEST['v']."'");
db_query("UPDATE prefix_downloads SET ssurl = '".$neudir.'/'.$_REQUEST['v']."' WHERE ssurl = '".$_REQUEST['f'].'/'.$_REQUEST['v']."'");
$msg = '<font color="#00FF00">Erfolgreich verschoben...</font><br />';
$_REQUEST['f'] = $neudir;
} else {
$msg = '<font color="#FF0000">Konnte Datei nicht verschieben</font></br />';
}
} else {
$msg = '<font color="#FF0000">Der angegebene Ordner ist nicht vorhanden...</font><br />';
}
}
# files anzeigen von ordner X... wenn x nicht definiert nimm downs/downloads...
# sonst halt downs/downloads/x/x1/x2...
$f = 'include/downs/downloads';
if (isset ($_REQUEST['f']) AND !empty($_REQUEST['f'])) {
$f = $_REQUEST['f'];
if ( strpos ( $f, '.' ) !== FALSE ) {
$f = dirname ( $f );
}
}
# positions liste definieren... (wo bin ich ;-))
$str_fl = '';
if ( $f != 'include/downs/downloads' ) {
$ar_f = explode('/',str_replace('include/downs/downloads/','',$f));
$str_nfl = '';
foreach ( $ar_f as $v ) {
$str_fl .= '<b> » </b><a href="?archiv-downloads-upload=0&f=include/downs/downloads/'.$str_nfl.$v.'">'.$v.'</a>';
$str_nfl .= $v.'/';
}
}
# template oeffnen
$tpl = new tpl ( 'archiv/upload', 1);
$tpl->set_ar_out(array('posi'=>$str_fl,'msg'=>$msg),0);
if ( is_dir ( $f ) ) {
# dir oeffnen und arrays fuellen einmal
# arrays mit ordner einmal mit files
$ar_files = array();
$ar_dirs = array();
$o = opendir ( $f );
while ( $v = readdir ( $o ) ) {
if ( $v == '.' OR $v == '..' ) { continue; }
$is_dir = is_dir ($f.'/'.$v);
if ( $is_dir AND is_writeable ($f.'/'.$v) ) {
$ar_dirs[] = $v;
} elseif ( !$is_dir ) {
$ar_files[] = $v;
}
}
$class = 'Cmite';
# arrays durchlaufen und mit entsprechenden aktionen bzw. links versehen.
# zuerstmal das dirs array dann das files...
foreach($ar_dirs as $v) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
echo '<tr class="'.$class.'"><td colspan="5"><a href="?archiv-downloads-upload=0&f='.$f.'/'.$v.'">'.$v.'/</a></td></tr>';
}
foreach($ar_files as $v) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
echo '<tr class="'.$class.'">';
echo '<td>'.$v.'</td>';
echo '<td><a href="javascript:deleteFile(\''.$f.'\',\''.$v.'\')"><img src="include/images/icons/del.gif" title="löschen" border="0" /></a></td>';
echo '<td><a href="javascript:moveFile(\''.$f.'\',\''.$v.'\')"><img src="include/images/icons/pfeila.gif" title="verschieben" border="0" /></a></td>';
echo '<td><a href="javascript:renFile(\''.$f.'\',\''.$v.'\')"><img src="include/images/icons/edit.gif" title="umbennen" border="0" /></a></td>';
echo '<td>'.get_upload_linked ( $f.'/'.$v ).'<a href="javascript:waehleThisFile(\''.$f.'/'.$v.'\')">wählen</a></td>';
echo '</tr>';
}
} else {
echo '<tr><td colspan="5" class="Cmite">Verzeichnis nicht gefunden... <a href="?archiv-downloads-upload">Übersicht</a></td></tr>';
}
$tpl->set('f',$f);
$tpl->out(1);
# ordner liste
echo upload_getdirlist ();
$tpl->out(2);
}
###################
# upload move file
if ( $menu->get(2) == 'uploadMoveFile' ) {
$tpl = new tpl ( 'archiv/upload_move_file', 1 );
$tpl->set('v',$_REQUEST['v']);
$tpl->set('f',$_REQUEST['f']);
$tpl->set('dirlist',uploadMoveFile_getdirlist());
$tpl->out(0);
}
if ( $menu->get(2) == 'upload' OR $menu->get(2) == 'uploadMoveFile' ) { exit (); }
$design = new design ( 'Admins Area', 'Admins Area', 2 );
$design->header();
$tpl = new tpl ( 'archiv/downloads', 1);
# kategorie und download eintraege loeschen
if ( $menu->getA(2) == 'D' ) {
$azk = db_result(db_query("SELECT cat FROM prefix_downcats WHERE id = '".$menu->getE(2)."'"),0);
$pos = db_result(db_query("SELECT pos FROM prefix_downcats WHERE id = '".$menu->getE(2)."'"),0);
db_query("DELETE FROM prefix_downcats WHERE id = '".$menu->getE(2)."'");
db_query("UPDATE prefix_downcats SET pos = pos - 1 WHERE pos > ".$pos." AND cat = ".$azk);
}
if ($menu->getA(2) == 'd' AND 1 == db_result(db_query("SELECT COUNT(*) FROM prefix_downloads WHERE id = ".intval($menu->getE(2))),0)) {
$r = db_fetch_assoc(db_query("SELECT cat, pos, url, surl, ssurl FROM prefix_downloads WHERE id = ".$menu->getE(2)));
$azk = $r['cat'];
$pos = $r['pos'];
unset ($r['cat']);
unset ($r['pos']);
# wenn url nur noch in diesem download vorhanden dann loeschen
foreach ($r as $k => $v) {
$qc = "SELECT COUNT(*) FROM prefix_downloads WHERE ".$k." = '".$v."'";
if (db_result(db_query($qc),0) == 1 AND @file_exists($v)) {
@unlink($v);
}
}
db_query("DELETE FROM prefix_downloads WHERE id = '".$menu->getE(2)."'");
db_query("UPDATE prefix_downloads SET pos = pos - 1 WHERE pos > ".$pos." AND cat = ".$azk);
}
# download eintraege speichern oder aendern.
if ( !empty($_POST['sub']) ) {
$_POST['url'] = $_POST['newurl'];
$_POST['cat'] = escape($_POST['cat'], 'integer');
$_POST['creater'] = escape($_POST['creater'], 'string');
$_POST['version'] = escape($_POST['version'], 'string');
$_POST['url'] = escape($_POST['url'], 'string');
$_POST['surl'] = escape($_POST['surl'], 'string');
$_POST['ssurl'] = escape($_POST['ssurl'], 'string');
$_POST['name'] = escape($_POST['name'], 'string');
$_POST['desc'] = escape($_POST['desc'], 'string');
$_POST['descl'] = escape($_POST['descl'], 'string');
if ( empty ($_POST['pkey']) ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_downloads WHERE cat = ".$_POST['cat']),0);
db_query("INSERT INTO prefix_downloads (`time`,`cat`,`creater`,`version`,`url`,surl,`ssurl`,`name`,`desc`,`descl`,pos) VALUES (NOW(),'".$_POST['cat']."','".$_POST['creater']."','".$_POST['version']."','".$_POST['url']."','".$_POST['surl']."','".$_POST['ssurl']."','".$_POST['name']."','".$_POST['desc']."','".$_POST['descl']."','".$pos."')");
} else {
$alt_row = db_fetch_assoc(db_query("SELECT cat,pos FROM prefix_downloads WHERE id = ".$_POST['pkey']));
if ( $alt_row['cat'] <> $_POST['cat'] ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_downloads WHERE cat = ".$_POST['cat']),0);
} else {
$pos = $alt_row['pos'];
}
db_query("UPDATE prefix_downloads SET pos = ".$pos.", `cat` = '".$_POST['cat']."',`creater` = '".$_POST['creater']."',version = '".$_POST['version']."',url = '".$_POST['url']."',surl = '".$_POST['surl']."',ssurl = '".$_POST['ssurl']."',`name` = '".$_POST['name']."',`desc` = '".$_POST['desc']."',descl = '".$_POST['descl']."' WHERE id = '".$_POST['pkey']."'");
if ( $alt_row['cat'] <> $_POST['cat'] ) {
db_query("UPDATE prefix_downloads SET pos = pos - 1 WHERE pos > ".$alt_row['pos']." AND cat = ".$alt_row['cat']);
}
}
$azk = $_POST['cat'];
}
# kategorie eintrage speichern oder aendern.
if ( isset ( $_POST['Csub']) ) {
if ( empty($_POST['Ccat']) ) {
$_POST['Ccat'] = 0;
}
if ( empty ($_POST['Cpkey']) ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_downcats WHERE cat = ".$_POST['Ccat']),0);
db_query("INSERT INTO prefix_downcats (`cat`,`name`,`desc`,pos,recht) VALUES (".$_POST['Ccat'].",'".$_POST['Cname']."','".$_POST['Cdesc']."','".$pos."','".$_POST['Crecht']."')");
} else {
$alt_row = db_fetch_assoc(db_query("SELECT cat,pos FROM prefix_downcats WHERE id = ".$_POST['Cpkey']));
if ( $alt_row['cat'] <> $_POST['Ccat'] ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_downcats WHERE cat = ".$_POST['Ccat']),0);
} else {
$pos = $alt_row['pos'];
}
db_query("UPDATE prefix_downcats SET `cat` = '".$_POST['Ccat']."',`name` = '".$_POST['Cname']."',pos = '".$pos."',`desc` = '".$_POST['Cdesc']."', recht = '".$_POST['Crecht']."' WHERE `id` = '".$_POST['Cpkey']."'");
if ( $alt_row['cat'] <> $_POST['Ccat'] ) {
db_query("UPDATE prefix_downcats SET pos = pos - 1 WHERE pos > ".$alt_row['pos']." AND cat = ".$alt_row['cat']);
}
}
$azk = $_POST['Ccat'];
}
# downloadeintrage verschieben.
if ( $menu->getA(3) == 'u' OR $menu->getA(3) == 'o' ){
$pos = $menu->get(4);
$id = $menu->getE(3);
$nps = ( $menu->getA(3) == 'u' ? $pos + 1 : $pos - 1 );
$anz = db_result(db_query("SELECT COUNT(*) FROM prefix_downloads WHERE cat = ".$menu->getE(2)),0);
if ($nps < 0) {
db_query("UPDATE prefix_downloads SET pos = ".$anz." WHERE id = ".$id);
db_query("UPDATE prefix_downloads SET pos = pos -1 WHERE cat = ".$menu->getE(2));
}
if ($nps >= $anz) {
db_query("UPDATE prefix_downloads SET pos = -1 WHERE id = ".$id);
db_query("UPDATE prefix_downloads SET pos = pos +1 WHERE cat = ".$menu->getE(2));
}
if ( $nps < $anz AND $nps >= 0 ) {
db_query("UPDATE prefix_downloads SET pos = ".$pos." WHERE pos = ".$nps." AND cat = ".$menu->getE(2));
db_query("UPDATE prefix_downloads SET pos = ".$nps." WHERE id = ".$id);
}
}
# download kategorien verschieben
if ( $menu->getA(3) == 'U' OR $menu->getA(3) == 'O' ){
$pos = $menu->get(4);
$id = $menu->getE(3);
$cat = db_result(db_query("SELECT cat FROM prefix_downcats WHERE id = ".$id),0);
$nps = ( $menu->getA(3) == 'U' ? $pos + 1 : $pos - 1 );
$anz = db_result(db_query("SELECT COUNT(*) FROM prefix_downcats WHERE cat = ".$cat),0);
if ($nps < 0) {
db_query("UPDATE prefix_downcats SET pos = ".$anz." WHERE id = ".$id);
db_query("UPDATE prefix_downcats SET pos = pos -1 WHERE cat = ".$cat);
}
if ($nps >= $anz) {
db_query("UPDATE prefix_downcats SET pos = -1 WHERE id = ".$id);
db_query("UPDATE prefix_downcats SET pos = pos +1 WHERE cat = ".$cat);
}
if ( $nps < $anz AND $nps >= 0 ) {
db_query("UPDATE prefix_downcats SET pos = ".$pos." WHERE pos = ".$nps." AND cat = ".$cat);
db_query("UPDATE prefix_downcats SET pos = ".$nps." WHERE id = ".$id);
}
}
# downs
if ( $menu->getA(2) == 'e' ) {
$erg = db_query("SELECT id,`cat`,creater,surl,ssurl,pos,version,url,`name`,`desc`,descl FROM prefix_downloads WHERE id = '".$menu->getE(2)."'");
$_ilch = db_fetch_assoc($erg);
$_ilch['pkey'] = $menu->getE(2);
$azk = $_ilch['cat'];
} else {
if ( isset ( $azk ) ) { $c = $azk; } elseif ( $menu->getA(2) == 'S' OR $menu->getA(2) == 'E' ) { $c = $menu->getE(2); } else { $c = 0; }
$_ilch = array (
'cat' => $c,
'creater' => '',
'surl' => '',
'ssurl' => '',
'pkey' => '',
'pos' => '',
'version' => '',
'name' => '',
'url' => '',
'desc' => '',
'descl' => ''
);
unset($c);
}
# wenn der link von archiv upload kommt ist dllink gesetzt
$dllink = '';
if ( isset($_REQUEST['dllink']) ) {
$dllink = $_REQUEST['dllink'];
} else {
$dllink = $_ilch['url'];
}
$_ilch['newurl'] = $_ilch['url'];
$_ilch['url'] = arlistee ( $dllink, get_downloads_ar() );
$_ilch['url'] = '<option value="neu">andere:</option>'.$_ilch['url'];
$_ilch['cat'] = dblistee ( $_ilch['cat'], "SELECT id,name FROM prefix_downcats ORDER BY name");
$_ilch['cat'] = '<option value="0">Keine</option>'.$_ilch['cat'];
if ( !isset($azk) ) {
$azk = 0;
if ( $menu->getA(2) == 'S' OR $menu->getA(2) == 'E' ) {
$azk = $menu->getE(2);
if ( $azk == 'a' ) { $azk = -1; }
}
}
# wenn userupload on und writeable dann koennen user
# dateien hochladen, also wird als kategorie link noch ein "freischalt" link hinzugefueght.
$frei = '';
if ( $allgAr['archiv_down_userupload'] == 1 AND is_writeable ( 'include/downs/downloads/user_upload' ) ) {
$frei = '<tr class="Cmite"><td colspan="5"><a href="?archiv-downloads-Sa">User-Uploads freischalten</a></td></tr>';
}
$tpl->out(0); $class = 0;
$abf = "SELECT id,`cat`,`version`,`name`,pos FROM prefix_downloads WHERE cat = ".$azk." ORDER BY pos";
$erg = db_query($abf);
while ($row = db_fetch_assoc($erg) ) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$row['class'] = $class;
$tpl->set_ar ( $row );
$tpl->out(1);
}
# downs
$tpl->set_out('frei',$frei,2);
# cat
if ( $menu->getA(2) == 'E' ) {
$erg = db_query("SELECT id,cat as Ccat, recht as Crecht, name as Cname,pos as Cpos,`desc` as Cdesc FROM prefix_downcats WHERE id = '".$menu->getE(2)."'");
$_Cilch = db_fetch_assoc($erg);
$_Cilch['Cpkey'] = $menu->getE(2);
} else {
$_Cilch = array (
'Ccat' => '',
'Cpkey' => '',
'Cpos' => '',
'Cname' => '',
'Crecht' => '',
'Cdesc' => ''
);
}
$_Cilch['Crecht'] = dblistee($_Cilch['Crecht'],"SELECT id,name FROM prefix_grundrechte ORDER BY id DESC");
$_Cilch['Ccat'] = dblistee($_Cilch['Ccat'], "SELECT id,name FROM prefix_downcats ORDER BY name");
$_Cilch['Ccat'] = '<option value="0">Keine</option>'.$_Cilch['Ccat'];
archiv_downs_admin_showcats ( 0 , '' );
$tpl->set_ar($_ilch);
$tpl->set_ar($_Cilch);
$tpl->out(3);
$design->footer();
break;
# # # # # # # # # # # # # # # # # # #
# Links
case 'links' :
$design = new design ( 'Admins Area', 'Admins Area', 2 );
$design->header();
$tpl = new tpl ( 'archiv/links', 1);
# kategorie und link eintraege loeschen
if ( $menu->getA(2) == 'D' ) {
$azk = db_result(db_query("SELECT cat FROM prefix_linkcats WHERE id = '".$menu->getE(2)."'"),0);
$pos = db_result(db_query("SELECT pos FROM prefix_linkcats WHERE id = '".$menu->getE(2)."'"),0);
db_query("DELETE FROM prefix_linkcats WHERE id = '".$menu->getE(2)."'");
db_query("UPDATE prefix_linkcats SET pos = pos - 1 WHERE pos > ".$pos." AND cat = ".$azk);
}
if ( $menu->getA(2) == 'd' ) {
$azk = db_result(db_query("SELECT cat FROM prefix_links WHERE id = '".$menu->getE(2)."'"),0);
$pos = db_result(db_query("SELECT pos FROM prefix_links WHERE id = '".$menu->getE(2)."'"),0);
db_query("DELETE FROM prefix_links WHERE id = ".$menu->getE(2));
db_query("UPDATE prefix_links SET pos = pos - 1 WHERE pos > ".$pos." AND cat = ".$azk);
}
# link eintraege speichern oder aendern.
if ( !empty($_POST['sub']) ) {
$_POST['cat'] = escape($_POST['cat'], 'integer');
$_POST['name'] = escape($_POST['name'], 'string');
$_POST['banner'] = escape($_POST['banner'], 'string');
$_POST['desc'] = escape($_POST['desc'], 'string');
$_POST['link'] = get_homepage(escape($_POST['link'], 'string'));
if ( empty ($_POST['pkey']) ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_links WHERE cat = ".$_POST['cat']),0);
db_query("INSERT INTO prefix_links (cat,name,banner,`desc`,link,pos) VALUES ('".$_POST['cat']."','".$_POST['name']."','".$_POST['banner']."','".$_POST['desc']."','".$_POST['link']."','".$pos."')");
} else {
$alt_row = db_fetch_assoc(db_query("SELECT cat,pos FROM prefix_links WHERE id = ".$_POST['pkey']));
if ( $alt_row['cat'] <> $_POST['cat'] ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_links WHERE cat = ".$_POST['cat']),0);
} else {
$pos = $alt_row['pos'];
}
db_query("UPDATE prefix_links SET cat = '".$_POST['cat']."',name = '".$_POST['name']."',pos = ".$pos.", banner = '".$_POST['banner']."',`desc` = '".$_POST['desc']."',link = '".$_POST['link']."' WHERE id = '".$_POST['pkey']."'");
if ( $alt_row['cat'] <> $_POST['cat'] ) {
db_query("UPDATE prefix_links SET pos = pos - 1 WHERE pos > ".$alt_row['pos']." AND cat = ".$alt_row['cat']);
}
}
$azk = $_POST['cat'];
}
# kategorie eintrage speichern oder aendern.
if ( isset ( $_POST['Csub']) ) {
if ( empty($_POST['Ccat']) ) {
$_POST['Ccat'] = 0;
}
if ( empty ($_POST['Cpkey']) ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_linkcats WHERE cat = ".$_POST['Ccat']),0);
db_query("INSERT INTO prefix_linkcats (`cat`,`name`,`desc`,pos) VALUES (".$_POST['Ccat'].",'".$_POST['Cname']."','".$_POST['Cdesc']."','".$pos."')");
} else {
$alt_row = db_fetch_assoc(db_query("SELECT cat,pos FROM prefix_linkcats WHERE id = ".$_POST['Cpkey']));
if ( $alt_row['cat'] <> $_POST['Ccat'] ) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_linkcats WHERE cat = ".$_POST['Ccat']),0);
} else {
$pos = $alt_row['pos'];
}
db_query("UPDATE prefix_linkcats SET `cat` = '".$_POST['Ccat']."',`name` = '".$_POST['Cname']."',pos = '".$pos."',`desc` = '".$_POST['Cdesc']."' WHERE `id` = '".$_POST['Cpkey']."'");
if ( $alt_row['cat'] <> $_POST['Ccat'] ) {
db_query("UPDATE prefix_linkcats SET pos = pos - 1 WHERE pos > ".$alt_row['pos']." AND cat = ".$alt_row['cat']);
}
}
$azk = $_POST['Ccat'];
}
# verschieben
if ( $menu->getA(3) == 'u' OR $menu->getA(3) == 'o' ){
$pos = $menu->get(4);
$id = $menu->getE(3);
$nps = ( $menu->getA(3) == 'u' ? $pos + 1 : $pos - 1 );
$anz = db_result(db_query("SELECT COUNT(*) FROM prefix_links WHERE cat = ".$menu->getE(2)),0);
if ($nps < 0) {
db_query("UPDATE prefix_links SET pos = ".$anz." WHERE id = ".$id);
db_query("UPDATE prefix_links SET pos = pos -1 WHERE cat = ".$menu->getE(2));
}
if ($nps >= $anz) {
db_query("UPDATE prefix_links SET pos = -1 WHERE id = ".$id);
db_query("UPDATE prefix_links SET pos = pos +1 WHERE cat = ".$menu->getE(2));
}
if ( $nps < $anz AND $nps >= 0 ) {
db_query("UPDATE prefix_links SET pos = ".$pos." WHERE pos = ".$nps." AND cat = ".$menu->getE(2));
db_query("UPDATE prefix_links SET pos = ".$nps." WHERE id = ".$id);
}
}
# link kategorien verschieben
if ( $menu->getA(3) == 'U' OR $menu->getA(3) == 'O' ){
$pos = $menu->get(4);
$id = $menu->getE(3);
$cat = db_result(db_query("SELECT cat FROM prefix_linkcats WHERE id = ".$id),0);
$nps = ( $menu->getA(3) == 'U' ? $pos + 1 : $pos - 1 );
$anz = db_result(db_query("SELECT COUNT(*) FROM prefix_linkcats WHERE cat = ".$cat),0);
if ($nps < 0) {
db_query("UPDATE prefix_linkcats SET pos = ".$anz." WHERE id = ".$id);
db_query("UPDATE prefix_linkcats SET pos = pos -1 WHERE cat = ".$cat);
}
if ($nps >= $anz) {
db_query("UPDATE prefix_linkcats SET pos = -1 WHERE id = ".$id);
db_query("UPDATE prefix_linkcats SET pos = pos +1 WHERE cat = ".$cat);
}
if ( $nps < $anz AND $nps >= 0 ) {
db_query("UPDATE prefix_linkcats SET pos = ".$pos." WHERE pos = ".$nps." AND cat = ".$cat);
db_query("UPDATE prefix_linkcats SET pos = ".$nps." WHERE id = ".$id);
}
}
# links
if ( $menu->getA(2) == 'e' ) {
$erg = db_query("SELECT id,cat,`desc`,name,banner,link FROM prefix_links WHERE id = '".$menu->getE(2)."'");
$_ilch = db_fetch_assoc($erg);
$_ilch['pkey'] = $menu->getE(2);
$azk = $_ilch['cat'];
} else {
if ( isset ( $azk ) ) { $c = $azk; } elseif ( $menu->getA(2) == 'S' OR $menu->getA(2) == 'E' ) { $c = $menu->getE(2); } else { $c = 0; }
$_ilch = array (
'pkey' => '',
'id' => '',
'banner' => '',
'name' => '',
'desc' => '',
'link' => '',
'cat' => $c
);
unset($c);
}
$_ilch['cat'] = dblistee ( $_ilch['cat'], "SELECT id,name FROM prefix_linkcats ORDER BY name");
$_ilch['cat'] = '<option value="0">Keine</option>'.$_ilch['cat'];
if ( !isset($azk) ) {
$azk = 0;
if ( $menu->getA(2) == 'S' OR $menu->getA(2) == 'E' ) {
$azk = $menu->getE(2);
}
}
$tpl->out(0); $class = 0;
$abf = "SELECT id,name,link,cat,pos FROM prefix_links WHERE cat = ".$azk." ORDER BY pos";
$erg = db_query($abf);
while ($row = db_fetch_assoc($erg) ) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$row['class'] = $class;
$tpl->set_ar ( $row );
$tpl->out(1);
}
# links
$tpl->out(2);
# cat
if ( $menu->getA(2) == 'E' ) {
$erg = db_query("SELECT id,cat as Ccat, name as Cname,pos as Cpos,`desc` as Cdesc FROM prefix_linkcats WHERE id = '".$menu->getE(2)."'");
$_Cilch = db_fetch_assoc($erg);
$_Cilch['Cpkey'] = $menu->getE(2);
} else {
$_Cilch = array (
'Ccat' => '',
'Cpkey' => '',
'Cpos' => '',
'Cname' => '',
'Cdesc' => ''
);
}
#$_Cilch['Crecht'] = arlistee($_Cilch['Crecht'],getFuerAr());
$_Cilch['Ccat'] = dblistee($_Cilch['Ccat'], "SELECT id,name FROM prefix_linkcats ORDER BY name");
$_Cilch['Ccat'] = '<option value="0">Keine</option>'.$_Cilch['Ccat'];
archiv_links_admin_showcats ( 0 , '' );
$tpl->set_ar($_ilch);
$tpl->set_ar($_Cilch);
$tpl->out(3);
$design->footer();
break;
# # # # # # # # # # # # # # # # # # #
# Partners
case 'partners' :
$design = new design ( 'Admins Area', 'Admins Area', 2 );
$design->header();
$tpl = new tpl ( 'archiv/partners', 1);
# loeschen
if ( $menu->getA(2) == 'd' ) {
$pos = db_result(db_query("SELECT pos FROM prefix_partners WHERE id = ".$menu->getE(2)), 0);
db_query("DELETE FROM prefix_partners WHERE id = ".$menu->getE(2));
db_query("UPDATE prefix_partners SET pos = pos -1 WHERE pos > ".$pos);
}
# aendern / eintragen
if ( isset($_POST['sub']) ) {
$_POST['name'] = escape($_POST['name'], 'string');
$_POST['banner'] = escape($_POST['banner'], 'string');
$_POST['link'] = get_homepage(escape($_POST['link'], 'string'));
if ( empty ($_POST['pkey']) ) {
$_POST['pos'] = db_result(db_query("SELECT COUNT(*) FROM prefix_partners"),0);
db_query("INSERT INTO prefix_partners (name,banner,link,pos) VALUES ('".$_POST['name']."','".$_POST['banner']."','".$_POST['link']."','".$_POST['pos']."')");
} else {
db_query("UPDATE prefix_partners SET name = '".$_POST['name']."',banner = '".$_POST['banner']."',link = '".$_POST['link']."' WHERE id = '".$_POST['pkey']."'");
}
}
# verschieben
if ($menu->getA(2) == 'o' OR $menu->getA(2) == 'u') {
$pos = $menu->get(3);
$id = $menu->getE(2);
$nps = ( $menu->getA(2) == 'u' ? $pos + 1 : $pos - 1 );
$anz = db_result(db_query("SELECT COUNT(*) FROM prefix_partners"),0);
if ($nps < 0) {
db_query("UPDATE prefix_partners SET pos = ".$anz." WHERE id = ".$id);
db_query("UPDATE prefix_partners SET pos = pos -1");
}
if ($nps >= $anz) {
db_query("UPDATE prefix_partners SET pos = -1 WHERE id = ".$id);
db_query("UPDATE prefix_partners SET pos = pos +1");
}
if ( $nps < $anz AND $nps >= 0 ) {
db_query("UPDATE prefix_partners SET pos = ".$pos." WHERE pos = ".$nps);
db_query("UPDATE prefix_partners SET pos = ".$nps." WHERE id = ".$id);
}
}
# aendern vorbereiten.
if ( $menu->getA(2) == 'e' ) {
$erg = db_query("SELECT id,name,banner,link FROM prefix_partners WHERE id = '".$menu->getE(2)."'");
$_ilch = db_fetch_assoc($erg);
$_ilch['pkey'] = $menu->getE(2);
} else {
$_ilch = array (
'pkey' => '',
'id' => '',
'banner' => '',
'name' => '',
'link' => ''
);
}
$tpl->set_ar_out($_ilch,0);
$page = ($menu->getA(2) == 'p' ? $menu->getE(2) : 1 );
$limit = 20; $class = 'Cnorm';
$MPL = db_make_sites ($page , '' , $limit , '?archiv-partners' , 'partners' );
$anfang = ($page - 1) * $limit;
$abf = "SELECT id,name,link, pos FROM prefix_partners ORDER BY pos ASC LIMIT ".$anfang.",".$limit;
$erg = db_query($abf);
while ($row = db_fetch_assoc($erg) ) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$row['class'] = $class;
$tpl->set_ar ( $row );
$tpl->out(1);
}
$tpl->set ( 'MPL', $MPL );
$tpl->out(2);
$design->footer();
break;
}
?>
include/admin/templates/archiv/upload.htm <html>
<head>
<link rel="stylesheet" type="text/css" href="include/admin/templates/style.css">
<script language="JavaScript" type="text/javascript">
<!--
function moveFile (f,v) {
var Fenster = window.open ('admin.php?archiv-downloads-uploadMoveFile=0&f=' + f + "&v=" + v, 'movefile', 'scrollbars=yes,height=100,width=200,left=500,top=100');
Fenster.focus();
}
function renFile (f,v) {
var x = prompt ( "Wie soll die neue Datei heissen?.", v);
if ( x ) {
document.location.href="admin.php?archiv-downloads-upload=0&f="+ f +"&v=" + v + "&r=" + x;
}
}
function closeThisWindow() {
opener.focus();
window.close();
}
function waehleThisFile ( fname ) {
opener.document.form.newurl.value = fname;
closeThisWindow();
}
function showDDetails ( eid ) {
opener.document.location.href = 'admin.php?archiv-downloads-e' + eid;
closeThisWindow();
}
function deleteFile (f,v) {
var x = confirm ( "Datei \"" + v + "\" wirklich l�schen?" );
if ( x ) {
document.location.href="admin.php?archiv-downloads-upload=0&f="+f+"&d="+v;
}
}
//-->
</script>
</head>
<body>
<table border="0" cellpadding="5" cellspacing="1" class="border">
<tr>
<td class="Callg">
{msg}
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td><h2>File Manager</h2></td><td align="right" valign="top"><a href="javascript:closeThisWindow()">Fenster schliessen</a></td></tr></table>
<br />
<b> » </b><a href="admin.php?archiv-downloads-upload">/</a>{posi}
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td valign="top" width="75%">
<table border="0" cellpadding="3" cellspacing="1" class="border" width="100%">
<tr class="Chead">
<td>Dateiname</td>
<td colspan="4"></td>
</tr>
{EXPLODE}
</table>
</td>
<td valign="top" width="25%">
<table border="0" cellpadding="3" cellspacing="1" class="border" width="100%" >
<tr class="Chead">
<td>Ordner</td>
</tr><tr>
<td class="Cnorm"><a href="admin.php?archiv-downloads-upload">/</a></td>
</tr>
{EXPLODE}
</table>
</td>
</tr>
</table>
<p></p>
<p></p>
<b>Datei hochladen</b>
<br /><br />
<form action="admin.php?archiv-downloads-upload" method="POST" enctype="multipart/form-data">
<input type="hidden" name="f" value="{f}" />
<table border="0" cellspacing="1" cellpadding="3" class="border">
<tr class="Cnorm">
<td width="70">Datei</td>
<td><input type="file" size="50" name="file"></td>
</tr>
<tr class="Cmite">
<td></td>
<td><input type="submit" name="sub" value="Hochladen"></td>
</tr>
</table>
</form>
<b>Datei aus dem Internet auf den Server laden</b>
<br /><br />
<form action="admin.php?archiv-downloads-upload-url" method="POST">
<input type="hidden" name="f" value="{f}" />
<table border="0" cellspacing="1" cellpadding="3" class="border">
<tr class="Cnorm">
<td width="70">Adresse</td>
<td><input type="text" size="59" name="url"></td>
</tr>
<tr class="Cmite">
<td></td>
<td><input type="submit" name="sub" value="Hochladen"></td>
</tr>
</table>
</form>
<p></p>
<div class="info_box">
<p>Eine Datei wird immer in das aktuelle Verzeichnis geladen, befinden Sie sich z.B. gerade in einem Ordner 'Movies/Fun' wird die Datei dort rein geladen.</p>
<p>Neue Ordner anlegen können Sie nur indem Sie im Ordner include/downs/downloads eine neue Ordner Struktur erstellen und jedem Ordner CHMOD Recht 777 geben. Sie können dort z.B. den Ordner Movies anlegen müssen diesem aber die nötigen Rechte geben. Sie müssen diese Ordner z.B. per FTP-Programm direkt auf Ihrem Webspace erstellen.</p>
<p>Die Spalte 'linked': Sie können der eben hochgeladenen Datei einen Download erstellen indem Sie auf 'neu' klicken. Die Zahlen in diesem Feld stellen bereits bestehende Downloads für diese Datei dar, Sie können diese Downloads ändern indem Sie auf die Zahl klicken.</p>
</div>
</td>
</tr>
</table>
</body>
</html>
Wobei es beim Einfügen wirklich keine Schwierigkeiten geben dürfte.