Gerne,
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>';
}
// file hochladen
if (isset ($_FILES['file']['name'])) {
$pathinfo = pathinfo($_FILES['file']['name']);
if (substr($pathinfo['extension'], 0, 3) == 'php') {
$msg = '<font color="#FF0000">Es können keine PHP Dateien hochgeladen werden.</font><br />';
} elseif (move_uploaded_file ($_FILES['file']['tmp_name'], $_REQUEST['f'] . '/' . $_FILES['file']['name'])) {
@chmod($_REQUEST['f'] . '/' . $_FILES['file']['name'], 0777);
$msg = 'Datei (' . $_FILES['file']['name'] . ' ) <font color="#00FF00">{_lang_erfolgreich}</font><br />';
} else {
$msg = 'Datei ( ' . $_FILES['file']['name'] . ' ) <font color="#FF0000">{_lang_filefail}</font><br />';
}
}
// datei loeschen
if (isset ($_REQUEST['d'])) {
unlink ($_REQUEST['f'] . '/' . $_REQUEST['d']);
}
// datei umbenennen
if (isset ($_REQUEST['r'])) {
$pathinfo = pathinfo($_REQUEST['r']);
if (substr($pathinfo['extension'], 0, 3) == 'php') {
$msg = '<font color="#FF0000">Es können keine PHP Dateien erzeugt werden.</font><br />';
} elseif (@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">{_lang_Erfolgreichumbenannt}</font><br />';
} else {
$msg = '<font color="#FF0000">{_lang_KonnteDateinichtumbennen}</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">{_lang_Erfolgreichverschoben...}</font><br />';
$_REQUEST['f'] = $neudir;
} else {
$msg = '<font color="#FF0000">{_lang_KonnteDateinichtumbennen}</font></br />';
}
} else {
$msg = '<font color="#FF0000">{_lang_DerangegebeneOrdneristnichtvorhanden}</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);
$azk = db_result(db_query("SELECT cat FROM prefix_downcats_english WHERE id = '" . $menu->getE(2) . "'"), 0);
$pos = db_result(db_query("SELECT pos FROM prefix_downcats_english WHERE id = '" . $menu->getE(2) . "'"), 0);
db_query("DELETE FROM prefix_downcats_english WHERE id = '" . $menu->getE(2) . "'");
db_query("UPDATE prefix_downcats_english 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'];
}
if ($_POST['refdate'] == 'on') {
$datum = '`time` = NOW(), ';
} else {
$datum = '';
}
db_query("UPDATE prefix_downloads SET " . $datum . "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'] . "')");
db_query("INSERT INTO prefix_downcats_english (`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']));
$bool = true;
$tc = $_POST['Ccat'];
while ($tc > 0) {
if ($tc == $_POST['Cpkey']) {
$bool = false;
}
$tc = @db_result(db_query("SELECT cat FROM prefix_downcats WHERE id = $tc"));
}
if ($bool) {
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);
}
if ($nps < 0) {
db_query("UPDATE prefix_downcats_english SET pos = " . $anz . " WHERE id = " . $id);
db_query("UPDATE prefix_downcats_english SET pos = pos -1 WHERE cat = " . $cat);
}
if ($nps >= $anz) {
db_query("UPDATE prefix_downcats_english SET pos = -1 WHERE id = " . $id);
db_query("UPDATE prefix_downcats_english SET pos = pos +1 WHERE cat = " . $cat);
}
if ($nps < $anz AND $nps >= 0) {
db_query("UPDATE prefix_downcats_english SET pos = " . $pos . " WHERE pos = " . $nps . " AND cat = " . $cat);
db_query("UPDATE prefix_downcats_english 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'];
$_ilch['datum'] = '<input type="checkbox" name="refdate" /><font color="white">{_lang_Datumaktualisieren}</font>';
} 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' => '',
'datum' => ''
);
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'];
archiv_downs_admin_selectcats('0', '', $_ilch['cat'], $_ilch['cat']);
$_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 ($menu->get(2) == 'Sa') {
$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`, `ssurl`,`pos` , `desc`, `url` 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;
$row['ssurl'] = $row['ssurl'];
$row['url'] = $row['url'];
if ( $i <> 0 AND ($i % $allgAr['down_imgs_per_line'] ) == 0 ) { echo '</tr><tr>'; }
$tpl->set_ar_out($row,1);
$i++;
}
// 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");
archiv_downs_admin_selectcats('0', '', $_Cilch['Ccat'], $_Cilch['Ccat']);
$_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;
// # # # # # # # # # # # # # # # # # #
//Events Upload
// # # # # # # # # # # # # # # # # # #
case 'events' :
if ($menu->get(2) == 'eventsupload') {
$msg = '';
// file rechte pruefen
if (!is_writeable ('include/images/events')) {
$msg = '<b>Bevor du hier eine Datei hochladen/verwalten kannst muss der Ordner include/images/<b>events</b>/ erstellt werden und er muss Schreibrechte ( chmod 777 ) erhalten !!! Wenn das geschehen ist einfach nochmal hier auf aktualisieren klicken</b>';
}
// file hochladen
if (isset ($_FILES['file']['name'])) {
$pathinfo = pathinfo($_FILES['file']['name']);
if (substr($pathinfo['extension'], 0, 3) == 'php') {
$msg = '<font color="#FF0000">Es können keine PHP Dateien hochgeladen werden.</font><br />';
} elseif (move_uploaded_file ($_FILES['file']['tmp_name'], $_REQUEST['f'] . '/' . $_FILES['file']['name'])) {
@chmod($_REQUEST['f'] . '/' . $_FILES['file']['name'], 0777);
$msg = 'Datei (' . $_FILES['file']['name'] . ' ) <font color="#00FF00">{_lang_erfolgreich}</font><br />';
} else {
$msg = 'Datei ( ' . $_FILES['file']['name'] . ' ) <font color="#FF0000">{_lang_filefail}</font><br />';
}
}
// datei loeschen
if (isset ($_REQUEST['d'])) {
unlink ($_REQUEST['f'] . '/' . $_REQUEST['d']);
}
// datei umbenennen
if (isset ($_REQUEST['r'])) {
$pathinfo = pathinfo($_REQUEST['r']);
if (substr($pathinfo['extension'], 0, 3) == 'php') {
$msg = '<font color="#FF0000">Es können keine PHP Dateien erzeugt werden.</font><br />';
} elseif (@rename ($_REQUEST['f'] . '/' . $_REQUEST['v'], $_REQUEST['f'] . '/' . $_REQUEST['r'])) {
db_query("UPDATE prefix_events_downloads SET url = '" . $_REQUEST['f'] . '/' . $_REQUEST['r'] . "' WHERE url = '" . $_REQUEST['f'] . '/' . $_REQUEST['v'] . "'");
db_query("UPDATE prefix_events_downloads SET surl = '" . $_REQUEST['f'] . '/' . $_REQUEST['r'] . "' WHERE surl = '" . $_REQUEST['f'] . '/' . $_REQUEST['v'] . "'");
db_query("UPDATE prefix_events_downloads SET ssurl = '" . $_REQUEST['f'] . '/' . $_REQUEST['r'] . "' WHERE ssurl = '" . $_REQUEST['f'] . '/' . $_REQUEST['v'] . "'");
$msg = '<font color="#00FF00">{_lang_Erfolgreichumbenannt}</font><br />';
} else {
$msg = '<font color="#FF0000">{_lang_KonnteDateinichtumbennen}</font></br />';
}
}
if (isset ($_REQUEST['n'])) {
$neudir = 'include/images/events/' . str_replace('.', '', $_REQUEST['n']);
if ($_REQUEST['n'] == '/') {
$neudir = 'include/images/events';
}
if (is_dir ($neudir) AND is_writeable ($neudir)) {
if (@rename ($_REQUEST['f'] . '/' . $_REQUEST['v'], $neudir . '/' . $_REQUEST['v'])) {
db_query("UPDATE prefix_events_downloads SET url = '" . $neudir . '/' . $_REQUEST['v'] . "' WHERE url = '" . $_REQUEST['f'] . '/' . $_REQUEST['v'] . "'");
db_query("UPDATE prefix_events_downloads SET surl = '" . $neudir . '/' . $_REQUEST['v'] . "' WHERE surl = '" . $_REQUEST['f'] . '/' . $_REQUEST['v'] . "'");
db_query("UPDATE prefix_events_downloads SET ssurl = '" . $neudir . '/' . $_REQUEST['v'] . "' WHERE ssurl = '" . $_REQUEST['f'] . '/' . $_REQUEST['v'] . "'");
$msg = '<font color="#00FF00">{_lang_Erfolgreichverschoben...}</font><br />';
$_REQUEST['f'] = $neudir;
} else {
$msg = '<font color="#FF0000">{_lang_KonnteDateinichtumbennen}</font></br />';
}
} else {
$msg = '<font color="#FF0000">{_lang_DerangegebeneOrdneristnichtvorhanden}</font><br />';
}
}
// files anzeigen von ordner X... wenn x nicht definiert nimm downs/downloads...
// sonst halt downs/downloads/x/x1/x2...
$f = 'include/images/events';
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/images/events') {
$ar_f = explode('/', str_replace('include/images/events/', '', $f));
$str_nfl = '';
foreach ($ar_f as $v) {
$str_fl .= '<b> » </b><a href="?archiv-events-eventsupload=0&f=include/images/events/' . $str_nfl . $v . '">' . $v . '</a>';
$str_nfl .= $v . '/';
}
}
// template oeffnen
$tpl = new tpl ('archiv/eventsupload', 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-events-eventsupload=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-events-eventsupload">Übersicht</a></td></tr>';
}
$tpl->set('f', $f);
$tpl->out(1);
// ordner liste
echo eventsupload_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', eventsuploadMoveFile_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/events', 1);
// kategorie und download eintraege loeschen
if ($menu->getA(2) == 'D') {
$azk = db_result(db_query("SELECT cat FROM prefix_events_downcats WHERE id = '" . $menu->getE(2) . "'"), 0);
$pos = db_result(db_query("SELECT pos FROM prefix_events_downcats WHERE id = '" . $menu->getE(2) . "'"), 0);
db_query("DELETE FROM prefix_events_downcats WHERE id = '" . $menu->getE(2) . "'");
db_query("UPDATE prefix_events_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_events_downloads WHERE id = " . intval($menu->getE(2))), 0)) {
$r = db_fetch_assoc(db_query("SELECT cat, pos, url, surl, ssurl FROM prefix_events_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_events_downloads WHERE " . $k . " = '" . $v . "'";
if (db_result(db_query($qc), 0) == 1 AND @file_exists($v)) {
@unlink($v);
}
}
db_query("DELETE FROM prefix_events_downloads WHERE id = '" . $menu->getE(2) . "'");
db_query("UPDATE prefix_events_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_events_downloads WHERE cat = " . $_POST['cat']), 0);
db_query("INSERT INTO prefix_events_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_events_downloads WHERE id = " . $_POST['pkey']));
if ($alt_row['cat'] != $_POST['cat']) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_events_downloads WHERE cat = " . $_POST['cat']), 0);
} else {
$pos = $alt_row['pos'];
}
if ($_POST['refdate'] == 'on') {
$datum = '`time` = NOW(), ';
} else {
$datum = '';
}
db_query("UPDATE prefix_events_downloads SET " . $datum . "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_events_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_events_downcats WHERE cat = " . $_POST['Ccat']), 0);
db_query("INSERT INTO prefix_events_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_events_downcats 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_events_downcats WHERE id = $tc"));
}
if ($bool) {
if ($alt_row['cat'] != $_POST['Ccat']) {
$pos = db_result(db_query("SELECT COUNT(*) FROM prefix_events_downcats WHERE cat = " . $_POST['Ccat']), 0);
} else {
$pos = $alt_row['pos'];
}
db_query("UPDATE prefix_events_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_events_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_events_downloads WHERE cat = " . $menu->getE(2)), 0);
if ($nps < 0) {
db_query("UPDATE prefix_events_downloads SET pos = " . $anz . " WHERE id = " . $id);
db_query("UPDATE prefix_events_downloads SET pos = pos -1 WHERE cat = " . $menu->getE(2));
}
if ($nps >= $anz) {
db_query("UPDATE prefix_events_downloads SET pos = -1 WHERE id = " . $id);
db_query("UPDATE prefix_events_downloads SET pos = pos +1 WHERE cat = " . $menu->getE(2));
}
if ($nps < $anz AND $nps >= 0) {
db_query("UPDATE prefix_events_downloads SET pos = " . $pos . " WHERE pos = " . $nps . " AND cat = " . $menu->getE(2));
db_query("UPDATE prefix_events_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_events_downcats WHERE id = " . $id), 0);
$nps = ($menu->getA(3) == 'U' ? $pos + 1 : $pos - 1);
$anz = db_result(db_query("SELECT COUNT(*) FROM prefix_events_downcats WHERE cat = " . $cat), 0);
if ($nps < 0) {
db_query("UPDATE prefix_events_downcats SET pos = " . $anz . " WHERE id = " . $id);
db_query("UPDATE prefix_events_downcats SET pos = pos -1 WHERE cat = " . $cat);
}
if ($nps >= $anz) {
db_query("UPDATE prefix_events_downcats SET pos = -1 WHERE id = " . $id);
db_query("UPDATE prefix_events_downcats SET pos = pos +1 WHERE cat = " . $cat);
}
if ($nps < $anz AND $nps >= 0) {
db_query("UPDATE prefix_events_downcats SET pos = " . $pos . " WHERE pos = " . $nps . " AND cat = " . $cat);
db_query("UPDATE prefix_events_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_events_downloads WHERE id = '" . $menu->getE(2) . "'");
$_ilch = db_fetch_assoc($erg);
$_ilch['pkey'] = $menu->getE(2);
$azk = $_ilch['cat'];
$_ilch['datum'] = '<input type="checkbox" name="refdate" /><font color="white">{_lang_Datumaktualisieren}</font>';
} 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' => '',
'datum' => ''
);
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_events_ar());
$_ilch['url'] = '<option value="neu">andere:</option>' . $_ilch['url'];
archiv_events_admin_selectcats('0', '', $_ilch['cat'], $_ilch['cat']);
$_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 ($menu->get(2) == 'Sa') {
$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/images/events/user_upload')) {
$frei = '<tr class="Cmite"><td colspan="5"><a href="?archiv-events-Sa">User-Uploads freischalten</a></td></tr>';
}
$tpl->out(0);
$class = 0;
$abf = "SELECT id,`cat`,`version`,`name`, `url`,`pos` , `desc` FROM prefix_events_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;
$row['url'] = $row['url'];
if ( $i <> 0 AND ($i % $allgAr['down_imgs_per_line'] ) == 0 ) { echo '</tr><tr>'; }
$tpl->set_ar_out($row,1);
$i++;
}
// 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_events_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");
archiv_events_admin_selectcats('0', '', $_Cilch['Ccat'], $_Cilch['Ccat']);
$_Cilch['Ccat'] = '<option value="0">Keine</option>' . $_Cilch['Ccat'];
archiv_events_admin_showcats (0 , '');
$tpl->set_ar($_ilch);
$tpl->set_ar($_Cilch);
$tpl->out(3);
$design->footer();
break;
Zuletzt modifiziert von samo am 19.11.2013 - 13:57:53
Ain't no use running, fool! I know where your mama parks your house