Пример #1
0
 function systems_add()
 {
     global $set, $db, $apx;
     //Absenden
     if ($_POST['send']) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title']) {
             info($apx->lang->get('CORE_BACK'), 'back');
         } else {
             //Standardbelegung
             $_POST['grouptype'] = 'system';
             $_POST['type'] = 'game';
             $db->dinsert(PRE . '_products_groups', 'title,icon,type,grouptype');
             $nid = $db->insert_id();
             logit('PRODUCTS_SYSTEMS_ADD', 'ID #' . $nid);
             if ($_REQUEST['updateparent']) {
                 printJSUpdateObject($_REQUEST['updateparent'], $this->get_systems(array($nid)));
             } else {
                 printJSRedirect('action.php?action=products.systems');
             }
         }
     } else {
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('ICON', compatible_hsc($_POST['icon']));
         $apx->tmpl->assign('UPDATEPARENT', $_REQUEST['updateparent']);
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->parse('sysadd_sysedit');
     }
 }
Пример #2
0
 function catadd()
 {
     global $set, $db, $apx;
     if ($_REQUEST['updateparent']) {
         $_POST['open'] = 1;
     }
     if (!count($_POST['groupid']) || $_POST['groupid'][0] == 'all') {
         $_POST['groupid'] = array('all');
     }
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['parent']) {
             infoNotComplete();
         } else {
             //WENN ROOT
             if ($_POST['parent'] == 'root') {
                 if ($_POST['groupid'][0] == 'all') {
                     $_POST['forgroup'] = 'all';
                 } else {
                     $_POST['forgroup'] = serialize($_POST['groupid']);
                 }
                 $nid = $this->cat->createNode(0, array('title' => $_POST['title'], 'text' => $_POST['text'], 'icon' => $_POST['icon'], 'open' => $_POST['open'], 'forgroup' => $_POST['forgroup']));
                 logit('VIDEOS_CATADD', 'ID #' . $nid);
                 //Beitrag der Kategorie hinzufügen
                 if ($_REQUEST['updateparent']) {
                     printJSUpdateObject($_REQUEST['updateparent'], $this->get_catlist($nid));
                 } else {
                     printJSRedirect('action.php?action=videos.catshow');
                 }
             } else {
                 if ($_POST['groupid'][0] == 'all') {
                     $_POST['forgroup'] = 'all';
                 } else {
                     $_POST['forgroup'] = serialize($_POST['groupid']);
                 }
                 $nid = $this->cat->createNode(intval($_POST['parent']), array('title' => $_POST['title'], 'text' => $_POST['text'], 'icon' => $_POST['icon'], 'open' => $_POST['open'], 'forgroup' => $_POST['forgroup']));
                 logit('VIDEOS_CATADD', "ID #" . $nid);
                 //Beitrag der Kategorie hinzufügen
                 if ($_REQUEST['updateparent']) {
                     printJSUpdateObject($_REQUEST['updateparent'], $this->get_catlist($nid));
                 } else {
                     printJSRedirect('action.php?action=videos.catshow');
                 }
             }
         }
     } else {
         $_POST['open'] = 1;
         //Baum
         $catlist = '<option value="root" style="font-weight:bold;">' . $apx->lang->get('ROOT') . '</option>';
         $data = $this->cat->getTree(array('title'));
         if (count($data)) {
             $catlist .= '<option value=""></option>';
             foreach ($data as $res) {
                 $catlist .= '<option value="' . $res['id'] . '"' . iif($_POST['parent'] == $res['id'], ' selected="selected"') . '>' . str_repeat('&nbsp;&nbsp;', $res['level'] - 1) . replace($res['title']) . '</option>';
             }
         }
         //Benutzergruppen
         $data = $db->fetch("SELECT groupid,name FROM " . PRE . "_user_groups WHERE ( gtype='admin' OR gtype='indiv' ) ORDER BY name ASC");
         $grouplist .= '<option value="all"' . iif(!isset($_POST['groupid']) || $_POST['groupid'][0] == 'all', ' selected="selected"') . ' style="font-weight:bold;">' . $apx->lang->get('ALL') . '</option>';
         if (count($data)) {
             foreach ($data as $res) {
                 $grouplist .= '<option value="' . $res['groupid'] . '"' . iif(isset($_POST['groupid']) && in_array($res['groupid'], $_POST['groupid']), ' selected="selected"') . '>' . replace($res['name']) . '</option>';
             }
         }
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('ICON', compatible_hsc($_POST['icon']));
         $apx->tmpl->assign('OPEN', (int) $_POST['open']);
         $apx->tmpl->assign('CATLIST', $catlist);
         $apx->tmpl->assign('USERGROUPS', $grouplist);
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
         $apx->tmpl->parse('catadd_catedit');
     }
 }
Пример #3
0
 function catadd()
 {
     global $set, $db, $apx;
     if ($_REQUEST['updateparent']) {
         $_POST['open'] = 1;
     }
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['parent']) {
             infoNotComplete();
         } else {
             //WENN ROOT
             if ($_POST['parent'] == 'root') {
                 $nid = $this->cat->createNode(0, array('title' => $_POST['title'], 'text' => $_POST['text'], 'icon' => $_POST['icon'], 'open' => $_POST['open']));
                 logit('LINKS_CATADD', 'ID #' . $nid);
                 //Beitrag der Kategorie hinzufügen
                 if ($_REQUEST['updateparent']) {
                     printJSUpdateObject($_REQUEST['updateparent'], $this->get_catlist($nid));
                 } else {
                     printJSRedirect('action.php?action=links.catshow');
                 }
             } else {
                 $nid = $this->cat->createNode(intval($_POST['parent']), array('title' => $_POST['title'], 'text' => $_POST['text'], 'icon' => $_POST['icon'], 'open' => $_POST['open']));
                 logit('LINKS_CATADD', "ID #" . $nid);
                 //Beitrag der Kategorie hinzufügen
                 if ($_REQUEST['updateparent']) {
                     printJSUpdateObject($_REQUEST['updateparent'], $this->get_catlist($nid));
                 } else {
                     printJSRedirect('action.php?action=links.catshow');
                 }
             }
         }
     } else {
         $_POST['open'] = 1;
         //Baum
         $catlist = '<option value="root" style="font-weight:bold;">' . $apx->lang->get('ROOT') . '</option>';
         $data = $this->cat->getTree(array('title'));
         if (count($data)) {
             $catlist .= '<option value=""></option>';
             foreach ($data as $res) {
                 $catlist .= '<option value="' . $res['id'] . '"' . iif($_POST['parent'] == $res['id'], ' selected="selected"') . '>' . str_repeat('&nbsp;&nbsp;', $res['level'] - 1) . replace($res['title']) . '</option>';
             }
         }
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('ICON', compatible_hsc($_POST['icon']));
         $apx->tmpl->assign('OPEN', (int) $_POST['open']);
         $apx->tmpl->assign('CATLIST', $catlist);
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
         $apx->tmpl->parse('catadd_catedit');
     }
 }
Пример #4
0
 function catadd()
 {
     global $set, $db, $apx;
     //ABSENDEN
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title']) {
             infoNotComplete();
         } else {
             $db->dinsert(PRE . '_glossar_cat', 'title,icon,text');
             $nid = $db->insert_id();
             logit('GLOSSAR_CATADD', 'ID #' . $nid);
             //Beitrag der Kategorie hinzufügen
             if ($_REQUEST['updateparent']) {
                 printJSUpdateObject($_REQUEST['updateparent'], $this->get_catlist($nid));
             } else {
                 printJSRedirect('action.php?action=glossar.catshow');
             }
         }
     } else {
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('ICON', compatible_hsc($_POST['icon']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
         $apx->tmpl->parse('catadd_catedit');
     }
 }
Пример #5
0
 function padd()
 {
     global $set, $db, $apx, $html;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     @set_time_limit(600);
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } else {
             $files = array();
             require_once BASEDIR . 'lib/class.mediamanager.php';
             $mm = new mediamanager();
             //ZIP
             if ($_REQUEST['what'] == 'zip' && $_FILES['zip']['tmp_name']) {
                 $mm->uploadfile($_FILES['zip'], 'gallery/uploads', $mm->getfile($_FILES['zip']['tmp_name']));
                 $zipfile = zip_open(BASEDIR . getpath('uploads') . 'gallery/uploads/' . $mm->getfile($_FILES['zip']['tmp_name']));
                 while ($zipentry = zip_read($zipfile)) {
                     if (zip_entry_open($zipfile, $zipentry, 'r')) {
                         if (substr(zip_entry_name($zipentry), -1) == '/') {
                             continue;
                         }
                         $content = zip_entry_read($zipentry, zip_entry_filesize($zipentry));
                         $zipname = str_replace('/', '%1%', zip_entry_name($zipentry));
                         $outfilepath = 'gallery/uploads/' . $zipname;
                         zip_entry_close($zipentry);
                         //Datei schreiben
                         $outfile = fopen(BASEDIR . getpath('uploads') . $outfilepath, 'w');
                         fwrite($outfile, $content);
                         fclose($outfile);
                         $ext = strtolower($mm->getext($outfilepath));
                         if ($ext == 'gif') {
                             $ext = 'jpg';
                         }
                         $files[] = array('ext' => $ext, 'source' => $outfilepath, 'watermark' => $_POST['watermark'], 'noresize' => $_POST['noresize'], 'allowcoms' => $_POST['allowcoms'], 'allowrating' => $_POST['allowrating'], 'caption' => $_POST['caption']);
                     }
                 }
                 zip_close($zipfile);
                 $mm->deletefile('gallery/uploads/' . $mm->getfile($_FILES['zip']['tmp_name']));
             } elseif ($_REQUEST['what'] == 'ftp') {
                 if (!is_array($_POST['ftp'])) {
                     $_POST['ftp'] = array();
                 }
                 require_once BASEDIR . 'lib/class.mediamanager.php';
                 $mm = new mediamanager();
                 foreach ($_POST['ftp'] as $key => $file) {
                     $file = $mm->securefile($file);
                     $ext = strtolower($mm->getext($file));
                     if ($ext == 'gif') {
                         $ext = 'jpg';
                     }
                     $files[] = array('ext' => $ext, 'source' => 'gallery/uploads/' . $file, 'watermark' => $_POST['watermark' . $key], 'noresize' => $_POST['noresize' . $key], 'allowcoms' => $_POST['allowcoms' . $key], 'allowrating' => $_POST['allowrating' . $key], 'caption' => $_POST['caption' . $key]);
                 }
             } else {
                 for ($i = 1; $i <= $set['gallery']['addpics']; $i++) {
                     if (!$_FILES['upload' . $i]['tmp_name']) {
                         continue;
                     }
                     //Erfolgreichen Upload prüfen
                     if (!$mm->uploadfile($_FILES['upload' . $i], 'gallery/uploads', $mm->getfile($_FILES['upload' . $i]['tmp_name']))) {
                         continue;
                     }
                     $ext = strtolower($mm->getext($_FILES['upload' . $i]['name']));
                     if ($ext == 'gif') {
                         $ext = 'jpg';
                     }
                     $files[] = array('ext' => $ext, 'source' => 'gallery/uploads/' . $mm->getfile($_FILES['upload' . $i]['tmp_name']), 'watermark' => $_POST['watermark' . $i], 'noresize' => $_POST['noresize' . $i], 'allowcoms' => $_POST['allowcoms' . $i], 'allowrating' => $_POST['allowrating' . $i], 'caption' => $_POST['caption' . $i]);
                 }
             }
             $this->process_files($files);
             //Gallery Updatetime
             $this->setGalleryUpdatetime($_REQUEST['id']);
             //Weitere Bilder anfügen
             if ($_POST['addnext']) {
                 printJSRedirect('action.php?action=gallery.padd&id=' . $_REQUEST['id'] . '&updateparent=' . $_REQUEST['updateparent']);
             } else {
                 if ($_REQUEST['updateparent']) {
                     printJSUpdateObject($_REQUEST['updateparent'], get_gallery_list($_REQUEST['id']));
                 } else {
                     printJSRedirect('action.php?action=gallery.pshow&id=' . $_REQUEST['id']);
                 }
             }
         }
     } else {
         //Layer
         $layerdef[] = array('LAYER_UPLOAD', 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;updateparent=' . $_REQUEST['updateparent'], !$_REQUEST['what']);
         $layerdef[] = array('LAYER_ZIP', 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=zip&amp;updateparent=' . $_REQUEST['updateparent'], $_REQUEST['what'] == 'zip');
         $layerdef[] = array('LAYER_FTP', 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=ftp&amp;updateparent=' . $_REQUEST['updateparent'], $_REQUEST['what'] == 'ftp');
         if (!function_exists('zip_open')) {
             unset($layerdef[1]);
         }
         $html->layer_header($layerdef);
         //ZIP
         if ($_REQUEST['what'] == 'zip') {
             $apx->tmpl->assign('ID', $_REQUEST['id']);
             $apx->tmpl->assign('SET_OPTIONS', $apx->is_module('comments') && $set['gallery']['coms'] || $apx->is_module('ratings') && $set['gallery']['ratings'] || $set['gallery']['watermark'] || $set['gallery']['picwidth'] && $set['gallery']['picheight']);
             $apx->tmpl->assign('SET_COMS', $apx->is_module('comments') && $set['gallery']['coms']);
             $apx->tmpl->assign('SET_RATING', $apx->is_module('ratings') && $set['gallery']['ratings']);
             $apx->tmpl->assign('SET_WATERMARK', iif($set['gallery']['watermark'], 1, 0));
             $apx->tmpl->assign('SET_NORESIZE', iif($set['gallery']['picwidth'] && $set['gallery']['picheight'], 1, 0));
             $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
             $apx->tmpl->parse('padd_zip');
         } elseif ($_REQUEST['what'] == 'ftp') {
             require_once BASEDIR . 'lib/class.mediamanager.php';
             $mm = new mediamanager();
             $extensions = array('jpg', 'jpeg', 'jpe', 'png', 'gif');
             $files = array();
             $dirs = array();
             if (is_dir(BASEDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/'))) {
                 $dir = opendir(BASEDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/'));
                 while ($file = readdir($dir)) {
                     if ($file == '.' || $file == '..') {
                         continue;
                     }
                     //Ordner
                     if (is_dir(BASEDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file)) {
                         $dirs[] = $file;
                         continue;
                     }
                     //Datei
                     if (!in_array(strtolower($mm->getext($file)), $extensions)) {
                         continue;
                     }
                     $files[] = $file;
                 }
                 closedir($dir);
             }
             sort($files);
             sort($dirs);
             //Ordner auflisten
             foreach ($dirs as $dir) {
                 ++$i;
                 $subdir[$i]['NAME'] = $dir;
                 $subdir[$i]['LINK'] = 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=ftp&amp;dir=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $dir;
             }
             //Dateien auflisten
             foreach ($files as $file) {
                 ++$i;
                 $upload[$i]['FILE'] = $file;
                 $upload[$i]['FILEID'] = iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file;
                 $upload[$i]['LINK'] = HTTPDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file;
             }
             //Pfad erstellen
             $pp = explode('/', $_REQUEST['dir']);
             if ($_REQUEST['dir'] && count($pp)) {
                 foreach ($pp as $dirname) {
                     ++$i;
                     $path .= iif($path, '/') . $dirname;
                     $pathdata[$i]['NAME'] = $dirname;
                     $pathdata[$i]['LINK'] = 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=ftp&amp;dir=' . $path;
                 }
             }
             $apx->tmpl->assign('ID', $_REQUEST['id']);
             $apx->tmpl->assign('FTP', $upload);
             $apx->tmpl->assign('DIR', $subdir);
             $apx->tmpl->assign('PATH', $pathdata);
             $apx->tmpl->assign('SET_OPTIONS', $apx->is_module('comments') && $set['gallery']['coms'] || $apx->is_module('ratings') && $set['gallery']['ratings'] || $set['gallery']['watermark'] || $set['gallery']['picwidth'] && $set['gallery']['picheight']);
             $apx->tmpl->assign('SET_COMS', $apx->is_module('comments') && $set['gallery']['coms']);
             $apx->tmpl->assign('SET_RATING', $apx->is_module('ratings') && $set['gallery']['ratings']);
             $apx->tmpl->assign('SET_WATERMARK', iif($set['gallery']['watermark'], 1, 0));
             $apx->tmpl->assign('SET_NORESIZE', iif($set['gallery']['picwidth'] && $set['gallery']['picheight'], 1, 0));
             $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
             $apx->tmpl->parse('padd_ftp');
         } else {
             for ($i = 1; $i <= $set['gallery']['addpics']; $i++) {
                 $upload[$i]['ASD'] = 1;
             }
             $apx->tmpl->assign('ID', $_REQUEST['id']);
             $apx->tmpl->assign('UPLOAD', $upload);
             $apx->tmpl->assign('SET_COMS', $apx->is_module('comments') && $set['gallery']['coms']);
             $apx->tmpl->assign('SET_RATING', $apx->is_module('ratings') && $set['gallery']['ratings']);
             $apx->tmpl->assign('SET_WATERMARK', iif($set['gallery']['watermark'], 1, 0));
             $apx->tmpl->assign('SET_NORESIZE', iif($set['gallery']['picwidth'] && $set['gallery']['picheight'], 1, 0));
             $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
             $apx->tmpl->parse('padd_upload');
         }
         //Layer Ende
         $html->layer_footer();
     }
 }