Example #1
0
 function add()
 {
     global $set, $db, $apx;
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['parent'] || !$_POST['question']) {
             infoNotComplete();
         } else {
             $insert = array('question' => $_POST['question'], 'answer' => $_POST['answer'], 'meta_description' => $_POST['meta_description'], 'searchable' => $_POST['searchable'], 'addtime' => time());
             //EINTRAG FREISCHALTEN
             if ($apx->user->has_right('faq.enable') && $_POST['pubnow']) {
                 //Prüfen, ob der Elternknoten deaktiviert ist => falls ja den Knoten deaktivieren
                 if ($_POST['parent'] == 'root') {
                     $insert['starttime'] = time();
                 } else {
                     list($parentEnabled) = $db->first("SELECT starttime FROM " . PRE . "_faq WHERE id='" . intval($_POST['parent']) . "' LIMIT 1");
                     if ($parentEnabled) {
                         $insert['starttime'] = time();
                     }
                 }
             }
             //WENN ROOT
             if ($_POST['parent'] == 'root') {
                 $nid = $this->cat->createNode(0, $insert);
                 logit('FAQ_ADD', 'ID #' . $nid);
             } else {
                 $nid = $this->cat->createNode(intval($_POST['parent']), $insert);
                 logit('FAQ_ADD', "ID #" . $nid);
             }
             //Inlinescreens
             mediamanager_setinline($this->cat->lastid);
             //Message ausgeben oder neuer Eintrag
             if ($_POST['submit_next']) {
                 printJSRedirect('action.php?action=faq.add&parent=' . $_REQUEST['parent']);
             } else {
                 printJSRedirect('action.php?action=faq.show');
             }
         }
     } else {
         $_POST['searchable'] = 1;
         $_POST['parent'] = $_GET['parent'];
         //Baum
         $catlist = '<option value="root" style="font-weight:bold;"' . iif($_POST['parent'] == 'root', ' selected="selected"') . '>' . $apx->lang->get('ROOT') . '</option><option value=""></option>';
         $data = $this->cat->getTree(array('question'));
         if (count($data)) {
             foreach ($data as $res) {
                 $catlist .= '<option value="' . $res['id'] . '"' . iif($_POST['parent'] == $res['id'], ' selected="selected"') . '>' . str_repeat('&nbsp;&nbsp;', $res['level'] - 1) . replace(shorttext($res['question'], 80)) . '</option>';
             }
         }
         $apx->tmpl->assign('CATLIST', $catlist);
         $apx->tmpl->assign('QUESTION', compatible_hsc($_POST['question']));
         $apx->tmpl->assign('ANSWER', compatible_hsc($_POST['answer']));
         $apx->tmpl->assign('META_DESCRIPTION', compatible_hsc($_POST['meta_description']));
         $apx->tmpl->assign('SEARCHABLE', (int) $_POST['searchable']);
         $apx->tmpl->assign('PUBNOW', (int) $_POST['pubnow']);
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->parse('add_edit');
     }
 }
Example #2
0
 function add()
 {
     global $set, $db, $apx;
     //Sektions-Liste
     if (!is_array($_POST['secid']) || $_POST['secid'][0] == 'all') {
         $_POST['secid'] = array('all');
     }
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['catid'] || !$_POST['title'] || !$_POST['text']) {
             infoNotComplete();
         } else {
             $_POST['secid'] = serialize_section($_POST['secid']);
             $_POST['time'] = time();
             $_POST['lastchange'] = time();
             $_POST['lastchange_userid'] = $apx->user->userid['userid'];
             //Aktivierung
             if ($apx->user->has_right('content.enable') && $_POST['pubnow']) {
                 $_POST['active'] = 1;
             }
             //Autor erzwingen, wenn keine Sonderrechte
             if (!$apx->user->has_spright('content.edit')) {
                 $_POST['userid'] = $apx->user->info['userid'];
             }
             $db->dinsert(PRE . '_content', 'secid,catid,title,text,meta_description,userid,time,lastchange,lastchange_userid,searchable,allowcoms,allowrating,active');
             $nid = $db->insert_id();
             logit('CONTENT_ADD', 'ID #' . $nid);
             //Inlinescreens
             mediamanager_setinline($nid);
             printJSRedirect('action.php?action=content.show');
         }
     } else {
         $_POST['userid'] = $apx->user->info['userid'];
         $_POST['searchable'] = $_POST['allowcoms'] = $_POST['allowrating'] = 1;
         mediamanager('content');
         $apx->tmpl->assign('CATLIST', $this->get_catlist($_POST['catid']));
         $apx->tmpl->assign('SECID', $_POST['secid']);
         $apx->tmpl->assign('USERID', $_POST['userid']);
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('META_DESCRIPTION', compatible_hsc($_POST['meta_description']));
         $apx->tmpl->assign('ALLOWCOMS', (int) $_POST['allowcoms']);
         $apx->tmpl->assign('ALLOWRATING', (int) $_POST['allowrating']);
         $apx->tmpl->assign('PUBNOW', (int) $_POST['pubnow']);
         $apx->tmpl->assign('SEARCHABLE', (int) $_POST['searchable']);
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->parse('add_edit');
     }
 }
Example #3
0
 function add_book()
 {
     global $set, $db, $apx;
     $thistype = 'book';
     if ($_POST['send'] == 2) {
         //Begriff bereits vorhanden?
         $duplicate = false;
         if ($_POST['send'] == 2 && !$_POST['ignore']) {
             list($duplicate) = $db->first("SELECT id FROM " . PRE . "_products WHERE title LIKE '" . addslashes($_POST['title']) . "' LIMIT 1");
         }
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['text']) {
             infoNotComplete();
         } elseif ($duplicate) {
             info($apx->lang->get('MSG_DUPLICATE'));
             echo '<script type="text/javascript"> parent.document.forms[0].ignore.value = 1; </script>';
         } elseif (!$this->update_pic()) {
             /*DO NOTHING*/
         } elseif (!$this->update_teaserpic()) {
             /*DO NOTHING*/
         } else {
             //Website-URLs clean
             if (substr($_POST['website'], 0, 4) == 'www.') {
                 $_POST['website'] = 'http://' . $_POST['website'];
             }
             $_POST['type'] = $thistype;
             $_POST['addtime'] = time();
             $_POST['picture'] = $this->picpath;
             $_POST['teaserpic'] = $this->teaserpicpath;
             $_POST['media'] = dash_serialize(array_map('intval', $_POST['media']));
             //Freischalten
             if ($apx->user->has_right('products.enable') && $_POST['pubnow']) {
                 $_POST['active'] = 1;
             } else {
                 $_POST['active'] = 0;
             }
             $db->dinsert(PRE . '_products', 'prodid,type,title,text,meta_description,picture,teaserpic,website,manufacturer,publisher,isbn,genre,media,custom1,custom2,custom3,custom4,custom5,custom6,custom7,custom8,custom9,custom10,buylink,price,recprice,guarantee,recprice,guarantee,addtime,allowcoms,allowrating,restricted,top,searchable,active');
             $nid = $db->insert_id();
             logit('PRODUCTS_ADD', 'ID #' . $nid);
             //Inlinescreens
             mediamanager_setinline($nid);
             //Release eintragen
             for ($i = 1; $i <= 10; $i++) {
                 if (!isset($_POST['release'][$i])) {
                     continue;
                 }
                 $element = $_POST['release'][$i];
                 if ($element['year']) {
                     list($reldata, $relstamp, $relsystem) = $this->generate_release($element);
                     $db->query("INSERT INTO " . PRE . "_products_releases (prodid,system,data,stamp) VALUES ('" . $nid . "','" . $relsystem . "','" . addslashes(serialize($reldata)) . "','" . $relstamp . "')");
                 }
             }
             //Tags
             $tagids = produceTagIds($_POST['tags']);
             foreach ($tagids as $tagid) {
                 $db->query("INSERT IGNORE INTO " . PRE . "_products_tags VALUES('" . $nid . "', '" . $tagid . "')");
             }
             if ($_REQUEST['updateparent']) {
                 printJSUpdateObject($_REQUEST['updateparent'], get_product_list($nid));
             } else {
                 printJSRedirect('action.php?action=products.show&what=' . $thistype);
             }
         }
     } else {
         $_POST['allowcoms'] = 1;
         $_POST['allowrating'] = 1;
         $_POST['searchable'] = 1;
         $_POST['pubnow'] = 1;
         $_POST['media'] = array();
         //Benutzerdefinierte Felder
         for ($i = 1; $i <= 10; $i++) {
             $fieldname = $set['products']['custom_' . $thistype][$i - 1];
             $apx->tmpl->assign('CUSFIELD' . $i . '_NAME', replace($fieldname));
             $apx->tmpl->assign('CUSTOM' . $i, compatible_hsc($_POST['custom' . $i]));
         }
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->assign('PRODID', intval($_POST['prodid']));
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('META_DESCRIPTION', compatible_hsc($_POST['meta_description']));
         $apx->tmpl->assign('PIC_COPY', compatible_hsc($_POST['pic_copy']));
         $apx->tmpl->assign('TEASERPIC_COPY', compatible_hsc($_POST['teaserpic_copy']));
         $apx->tmpl->assign('WEBSITE', compatible_hsc($_POST['website']));
         $apx->tmpl->assign('TAGS', compatible_hsc($_POST['tags']));
         $apx->tmpl->assign('MANUFACTURER', $this->get_units($_POST['manufacturer'], iif($set['products']['filtermanu'], 'person')));
         $apx->tmpl->assign('PUBLISHER', $this->get_units($_POST['publisher'], iif($set['products']['filtermanu'], 'company')));
         $apx->tmpl->assign('ISBN', compatible_hsc($_POST['isbn']));
         $apx->tmpl->assign('GENRELIST', $this->get_genre($thistype, $_POST['genre']));
         $apx->tmpl->assign('MEDIALIST', $this->get_media($thistype, $_POST['media']));
         $apx->tmpl->assign('RELEASE', $this->get_release($thistype));
         $apx->tmpl->assign('BUYLINK', compatible_hsc($_POST['buylink']));
         $apx->tmpl->assign('PRICE', compatible_hsc($_POST['price']));
         $apx->tmpl->assign('RECPRICE', compatible_hsc($_POST['recprice']));
         $apx->tmpl->assign('GUARANTEE', compatible_hsc($_POST['guarantee']));
         $apx->tmpl->assign('ALLOWCOMS', (int) $_POST['allowcoms']);
         $apx->tmpl->assign('ALLOWRATING', (int) $_POST['allowrating']);
         $apx->tmpl->assign('RESTRICTED', (int) $_POST['restricted']);
         $apx->tmpl->assign('TOP', (int) $_POST['top']);
         $apx->tmpl->assign('SEARCHABLE', (int) $_POST['searchable']);
         $apx->tmpl->assign('PUBNOW', (int) $_POST['pubnow']);
         $apx->tmpl->assign('UPDATEPARENT', (int) $_POST['updateparent']);
         $apx->tmpl->parse('add_edit_' . $thistype);
     }
 }
Example #4
0
 function add()
 {
     global $set, $db, $apx;
     //Sektions-Liste
     if (!is_array($_POST['secid']) || $_POST['secid'][0] == 'all') {
         $_POST['secid'] = array('all');
     }
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['catid'] || !$_POST['text']) {
             infoNotComplete();
         } elseif ($_POST['catid'] != 'newcat' && !$this->category_is_open($_POST['catid'])) {
             die('you are not allowed to add news to this category!');
         } elseif (!$this->update_newspic()) {
             /*DO NOTHING*/
         } else {
             $links = array();
             //Sources
             $sources = $this->get_sources();
             for ($i = 1; $i <= 20; $i++) {
                 if (!$_POST['source' . $i . '_title'] || !$_POST['source' . $i . '_id']) {
                     continue;
                 }
                 $sourceid = (int) $_POST['source' . $i . '_id'];
                 $links[] = array('title' => $_POST['source' . $i . '_title'], 'text' => $sources[$sourceid]['TITLE'], 'url' => $sources[$sourceid]['LINK'], 'popup' => (int) $_POST['source' . $i . '_popup']);
             }
             //Links
             for ($i = 1; $i <= 20; $i++) {
                 if (!$_POST['link' . $i . '_title'] || !$_POST['link' . $i . '_text'] || !$_POST['link' . $i . '_url']) {
                     continue;
                 }
                 $links[] = array('title' => $_POST['link' . $i . '_title'], 'text' => $_POST['link' . $i . '_text'], 'url' => $_POST['link' . $i . '_url'], 'popup' => (int) $_POST['link' . $i . '_popup']);
             }
             //Veröffentlichung: JETZT
             if ($_POST['pubnow'] && $apx->user->has_right('news.enable')) {
                 $_POST['starttime'] = time();
                 $_POST['endtime'] = 3000000000;
                 $addfields .= ',starttime,endtime';
             }
             //Sticky Ende
             if ($_POST['sticky'] && ($stickyend = maketime(3)) != 0) {
                 $_POST['sticky'] = $stickyend;
             } elseif ($_POST['sticky']) {
                 $_POST['sticky'] = 3000000000;
             }
             //Autor erzwingen, wenn keine Sonderechte
             if (!$apx->user->has_spright('news.edit')) {
                 $_POST['userid'] = $apx->user->info['userid'];
             }
             $_POST['secid'] = serialize_section($_POST['secid']);
             $_POST['addtime'] = time();
             $_POST['links'] = serialize($links);
             $_POST['newspic'] = $this->newspicpath;
             $db->dinsert(PRE . '_news', 'secid,prodid,catid,userid,title,subtitle,newspic,teaser,text,meta_description,galid,links,addtime,top,sticky,searchable,restricted,allowcoms,allowrating' . $addfields);
             $nid = $db->insert_id();
             logit('NEWS_ADD', 'ID #' . $nid);
             //Inlinescreens
             mediamanager_setinline($nid);
             //Tags
             $tagids = produceTagIds($_POST['tags']);
             foreach ($tagids as $tagid) {
                 $db->query("INSERT IGNORE INTO " . PRE . "_news_tags VALUES('" . $nid . "', '" . $tagid . "')");
             }
             if ($_POST['catid'] == 'newcat' && $apx->user->has_right('news.catadd')) {
                 printJSRedirect('action.php?action=news.catadd&addid=' . $nid);
             } else {
                 printJSRedirect('action.php?action=news.show');
             }
         }
     } else {
         $_POST['link1_title'] = $apx->lang->get('LLINK');
         $_POST['link1_popup'] = 1;
         $_POST['source1_title'] = $apx->lang->get('LSOURCE');
         $_POST['source1_popup'] = 1;
         $_POST['allowcoms'] = 1;
         $_POST['allowrating'] = 1;
         $_POST['searchable'] = 1;
         $_POST['userid'] = $apx->user->info['userid'];
         mediamanager('news');
         //Quellen auslesen
         $source_optionlist = $this->get_sources();
         //Quellen
         for ($i = 1; $i <= 20; $i++) {
             if ($i > 1 && (!$_POST['source' . $i . '_title'] || $_POST['source' . $i . '_title'] == $apx->lang->get('LSOURCE')) && !$_POST['source' . $i . '_id']) {
                 continue;
             }
             $sourcelist[] = array('TITLE' => compatible_hsc($_POST['source' . $i . '_title']), 'SELECTED' => (int) $_POST['source' . $i . '_id'], 'POPUP' => (int) $_POST['source' . $i . '_popup'], 'DISPLAY' => 1);
         }
         //Normale Links
         for ($i = 1; $i <= 20; $i++) {
             if ($i > 1 && (!$_POST['link' . $i . '_title'] || $_POST['link' . $i . '_title'] == $apx->lang->get('LLINK')) && !$_POST['link' . $i . '_text'] && !$_POST['link' . $i . '_url']) {
                 continue;
             }
             $linklist[] = array('TITLE' => compatible_hsc($_POST['link' . $i . '_title']), 'TEXT' => compatible_hsc($_POST['link' . $i . '_text']), 'URL' => compatible_hsc($_POST['link' . $i . '_url']), 'POPUP' => (int) $_POST['link' . $i . '_popup'], 'DISPLAY' => 1);
         }
         //Links + Sources füllen
         while (count($sourcelist) < 20) {
             $sourcelist[] = array('TITLE' => $apx->lang->get('LSOURCE'), 'POPUP' => 1);
         }
         while (count($linklist) < 20) {
             $linklist[] = array('TITLE' => $apx->lang->get('LLINK'), 'POPUP' => 1);
         }
         $apx->tmpl->assign('USERID', $_POST['userid']);
         $apx->tmpl->assign('PRODID', $_POST['prodid']);
         $apx->tmpl->assign('SECID', $_POST['secid']);
         $apx->tmpl->assign('GALID', $_POST['galid']);
         $apx->tmpl->assign('CATLIST', $this->get_catlist());
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('SUBTITLE', compatible_hsc($_POST['subtitle']));
         $apx->tmpl->assign('TEASER', compatible_hsc($_POST['teaser']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('META_DESCRIPTION', compatible_hsc($_POST['meta_description']));
         $apx->tmpl->assign('TAGS', compatible_hsc($_POST['tags']));
         $apx->tmpl->assign('PIC_COPY', compatible_hsc($_POST['pic_copy']));
         $apx->tmpl->assign('LINK', $linklist);
         $apx->tmpl->assign('SOURCE', $sourcelist);
         $apx->tmpl->assign('SOURCE_OPTIONS', $source_optionlist);
         $apx->tmpl->assign('ALLOWCOMS', (int) $_POST['allowcoms']);
         $apx->tmpl->assign('ALLOWRATING', (int) $_POST['allowrating']);
         $apx->tmpl->assign('TOP', (int) $_POST['top']);
         $apx->tmpl->assign('STICKY', (int) $_POST['sticky']);
         $apx->tmpl->assign('STICKYTIME', choosetime(3, 1, maketime(3)));
         $apx->tmpl->assign('PUBNOW', (int) $_POST['pubnow']);
         $apx->tmpl->assign('SEARCHABLE', (int) $_POST['searchable']);
         $apx->tmpl->assign('RESTRICTED', (int) $_POST['restricted']);
         $apx->tmpl->parse('add');
     }
 }
Example #5
0
 function edit()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['catid'] || !$_POST['text']) {
             infoNotComplete();
         } else {
             $db->dupdate(PRE . '_glossar', 'catid,title,spelling,text,meta_description,searchable,allowcoms,allowrating', "WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
             $nid = $db->insert_id();
             logit('GLOSSAR_ADD', 'ID #' . $nid);
             //Inlinescreens
             mediamanager_setinline($nid);
             //Tags
             $db->query("DELETE FROM " . PRE . "_glossar_tags WHERE id='" . $_REQUEST['id'] . "'");
             $tagids = produceTagIds($_POST['tags']);
             foreach ($tagids as $tagid) {
                 $db->query("INSERT IGNORE INTO " . PRE . "_glossar_tags VALUES('" . $_REQUEST['id'] . "', '" . $tagid . "')");
             }
             printJSRedirect(get_index('glossar.show'));
         }
     } else {
         $res = $db->first("SELECT * FROM " . PRE . "_glossar WHERE id='" . $_REQUEST['id'] . "' LIMIT 1", 1);
         foreach ($res as $key => $value) {
             $_POST[$key] = $value;
         }
         mediamanager('glossar');
         //Tags
         $tags = array();
         $tagdata = $db->fetch("\n\t\t\tSELECT t.tag\n\t\t\tFROM " . PRE . "_glossar_tags AS n\n\t\t\tLEFT JOIN " . PRE . "_tags AS t USING(tagid)\n\t\t\tWHERE n.id='" . $_REQUEST['id'] . "'\n\t\t\tORDER BY t.tag ASC\n\t\t");
         $tags = get_ids($tagdata, 'tag');
         $_POST['tags'] = implode(', ', $tags);
         $apx->tmpl->assign('CATLIST', $this->get_catlist($_POST['catid']));
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('META_DESCRIPTION', compatible_hsc($_POST['meta_description']));
         $apx->tmpl->assign('SPELLING', compatible_hsc($_POST['spelling']));
         $apx->tmpl->assign('TAGS', compatible_hsc($_POST['tags']));
         $apx->tmpl->assign('ALLOWCOMS', (int) $_POST['allowcoms']);
         $apx->tmpl->assign('ALLOWRATING', (int) $_POST['allowrating']);
         $apx->tmpl->assign('SEARCHABLE', (int) $_POST['searchable']);
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('ACTION', 'edit');
         $apx->tmpl->parse('add_edit');
     }
 }
Example #6
0
 function page_add_edit()
 {
     global $set, $db, $apx;
     //Artikel-Seite löschen
     if ($_REQUEST['del']) {
         $apx->lang->dropaction('articles', 'pdel');
         $this->page_del();
         return;
     } elseif ($_REQUEST['move'] && $_REQUEST['direction']) {
         $this->page_move();
         return;
     }
     list($brother1, $brother2) = $this->get_brothers();
     list($pagecount) = $db->first("SELECT count(id) FROM " . PRE . "_articles_pages WHERE artid='" . $_REQUEST['id'] . "'");
     if ($_POST['send'] == 1) {
         //Eine Seite zurück, wenn nichts ausgefüllt
         if ($_POST['submit_prev'] && !$_POST['title'] && !$_POST['text']) {
             list($brother1, $brother2) = $this->get_brothers();
             printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=' . $brother1);
         } elseif ($pagecount && $_POST['submit_finish'] && !$_POST['title'] && !$_POST['text']) {
             $this->finish_article();
             return;
         } elseif ($pagecount && $_POST['submit_walk'] && !$_POST['title'] && !$_POST['text']) {
             if ($this->type == 'normal') {
                 printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=pics');
                 return;
             } else {
                 printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=conclusion');
                 return;
             }
         } elseif (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['text']) {
             infoNotComplete();
         } else {
             //MYSQL einfügen: Neue Seite
             if ($_REQUEST['pageid'] == 'new') {
                 $_POST['artid'] = $_REQUEST['id'];
                 $_POST['addtime'] = time();
                 list($lastord) = $db->first("SELECT ord FROM " . PRE . "_articles_pages WHERE artid='" . $_REQUEST['id'] . "' ORDER BY ord DESC LIMIT 1");
                 $_POST['ord'] = $lastord + 1;
                 $db->dinsert(PRE . '_articles_pages', 'artid,title,text,ord');
                 //Inlinescreens
                 mediamanager_setinline($_REQUEST['id']);
             } else {
                 $db->dupdate(PRE . '_articles_pages', 'title,text', "WHERE ( id='" . $_REQUEST['pageid'] . "' AND artid='" . $_REQUEST['id'] . "' ) LIMIT 1");
             }
             //WEITER: Vorherige Seite
             if ($_POST['submit_prev']) {
                 printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=' . $brother1);
             } elseif ($_POST['submit_next'] && !$brother2) {
                 printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=new');
             } elseif ($_POST['submit_next']) {
                 printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=' . $brother2);
             } else {
                 if ($_POST['submit_finish']) {
                     $this->finish_article();
                     return;
                 } elseif ($this->type == 'normal') {
                     printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=pics');
                     return;
                 } else {
                     printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=conclusion');
                     return;
                 }
             }
         }
     } else {
         if ($_REQUEST['pageid'] != 'new') {
             list($_POST['title'], $_POST['text']) = $db->first("SELECT title,text FROM " . PRE . "_articles_pages WHERE ( id='" . $_REQUEST['pageid'] . "' AND artid='" . $_REQUEST['id'] . "' ) LIMIT 1");
         }
         $this->page_index();
         mediamanager('articles');
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('PAGEID', $_REQUEST['pageid']);
         $apx->tmpl->assign('SET_PREVIOUS', $brother1);
         $apx->tmpl->assign('SET_NEWPAGE', !$brother2);
         $apx->tmpl->assign('PUBNOW', (int) $_REQUEST['pubnow']);
         $apx->tmpl->assign('TYPE', $this->type);
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('ACTION', iif($_REQUEST['action'] == 'articles.add', 'add', 'edit'));
         $apx->tmpl->parse('padd_pedit');
     }
 }
Example #7
0
 function add()
 {
     global $set, $db, $apx;
     //Sektions-Liste
     if (!is_array($_POST['secid']) || $_POST['secid'][0] == 'all') {
         $_POST['secid'] = array('all');
     }
     //Absenden
     if ($_POST['send']) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['catid'] || !$_POST['title'] || !$_POST['text'] || !$_POST['start_day'] || !$_POST['start_month'] || !$_POST['start_year']) {
             infoNotComplete();
         } elseif (!$this->update_pic()) {
             /*DO NOTHING*/
         } else {
             $_POST['addtime'] = time();
             $_POST['picture'] = $this->picpath;
             $_POST['startday'] = $this->generate_stamp($_POST['start_day'], $_POST['start_month'], $_POST['start_year']);
             //Startzeit
             $_POST['starttime'] = -1;
             if ($_POST['start_hour'] !== '' && $_POST['start_minute'] !== '') {
                 $_POST['starttime'] = sprintf('%02d%02d', $_POST['start_hour'], $_POST['start_minute']);
             }
             //Termin Ende
             $_POST['endday'] = 0;
             if ($_POST['end_day'] !== '' && $_POST['end_month'] !== '' && $_POST['end_year'] !== '') {
                 $_POST['endday'] = $this->generate_stamp($_POST['end_day'], $_POST['end_month'], $_POST['end_year']);
                 $_POST['endtime'] = -1;
                 if ($_POST['end_hour'] !== '' && $_POST['end_minute'] !== '') {
                     $_POST['endtime'] = sprintf('%02d%02d', $_POST['end_hour'], $_POST['end_minute']);
                 }
             } else {
                 $_POST['endday'] = $_POST['startday'];
                 $_POST['endtime'] = -1;
             }
             //Links
             for ($i = 1; $i <= 20; $i++) {
                 if (!$_POST['link' . $i . '_title'] || !$_POST['link' . $i . '_text'] || !$_POST['link' . $i . '_url']) {
                     continue;
                 }
                 $links[] = array('title' => $_POST['link' . $i . '_title'], 'text' => $_POST['link' . $i . '_text'], 'url' => $_POST['link' . $i . '_url'], 'popup' => (int) $_POST['link' . $i . '_popup']);
             }
             $_POST['links'] = serialize($links);
             //Freischalten
             $_POST['active'] = 0;
             if ($apx->user->has_right('calendar.enable') && $_POST['pubnow']) {
                 $_POST['active'] = time();
             }
             //Sektion
             $_POST['secid'] = serialize_section($_POST['secid']);
             $db->dinsert(PRE . '_calendar_events', 'secid,catid,userid,title,text,location,location_link,picture,priority,meta_description,galid,links,addtime,startday,starttime,endday,endtime,searchable,restricted,allowcoms,allownote,active');
             $nid = $db->insert_id();
             logit('CALENDAR_ADD', 'ID #' . $nid);
             //Inlinescreens
             mediamanager_setinline($nid);
             //Tags
             $tagids = produceTagIds($_POST['tags']);
             foreach ($tagids as $tagid) {
                 $db->query("INSERT IGNORE INTO " . PRE . "_calendar_tags VALUES('" . $nid . "', '" . $tagid . "')");
             }
             printJSRedirect('action.php?action=calendar.show');
             return;
         }
     } else {
         $_POST['link1_title'] = $apx->lang->get('LLINK');
         $_POST['link1_popup'] = 1;
         $_POST['priority'] = 2;
         $_POST['searchable'] = 1;
         $_POST['allowcoms'] = 1;
         $_POST['allownote'] = 1;
         $_POST['pubnow'] = 1;
         $_POST['start_day'] = date('d', time() - TIMEDIFF);
         $_POST['start_month'] = date('m', time() - TIMEDIFF);
         $_POST['start_year'] = date('Y', time() - TIMEDIFF);
         $_POST['userid'] = $apx->user->info['userid'];
         //Normale Links
         if (!$_POST['link1_title']) {
             $_POST['link1_title'] = $apx->lang->get('LLINK');
         }
         for ($i = 1; $i <= 20; $i++) {
             if ($i > 1 && (!$_POST['link' . $i . '_title'] || $_POST['link' . $i . '_title'] == $apx->lang->get('LLINK')) && !$_POST['link' . $i . '_text'] && !$_POST['link' . $i . '_url']) {
                 continue;
             }
             $linklist[] = array('TITLE' => compatible_hsc($_POST['link' . $i . '_title']), 'TEXT' => compatible_hsc($_POST['link' . $i . '_text']), 'URL' => compatible_hsc($_POST['link' . $i . '_url']), 'POPUP' => (int) $_POST['link' . $i . '_popup'], 'DISPLAY' => 1);
         }
         while (count($linklist) < 20) {
             $linklist[] = array('TITLE' => $apx->lang->get('LLINK'), 'POPUP' => 1);
         }
         $apx->tmpl->assign('USERID', $_POST['userid']);
         $apx->tmpl->assign('SECID', $_POST['secid']);
         $apx->tmpl->assign('CATLIST', $this->get_catlist());
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('LOCATION', compatible_hsc($_POST['location']));
         $apx->tmpl->assign('LOCATION_LINK', compatible_hsc($_POST['location_link']));
         $apx->tmpl->assign('START_DAY', (int) $_POST['start_day']);
         $apx->tmpl->assign('START_MONTH', (int) $_POST['start_month']);
         $apx->tmpl->assign('START_YEAR', (int) $_POST['start_year']);
         $apx->tmpl->assign('START_HOUR', $_POST['start_hour']);
         $apx->tmpl->assign('START_MINUTE', $_POST['start_minute']);
         $apx->tmpl->assign('END_DAY', (int) $_POST['end_day']);
         $apx->tmpl->assign('END_MONTH', (int) $_POST['end_month']);
         $apx->tmpl->assign('END_YEAR', (int) $_POST['end_year']);
         $apx->tmpl->assign('END_HOUR', $_POST['end_hour']);
         $apx->tmpl->assign('END_MINUTE', $_POST['end_minute']);
         $apx->tmpl->assign('GALID', (int) $_POST['galid']);
         $apx->tmpl->assign('PRIORITY', (int) $_POST['priority']);
         $apx->tmpl->assign('META_DESCRIPTION', compatible_hsc($_POST['meta_description']));
         $apx->tmpl->assign('TAGS', compatible_hsc($_POST['tags']));
         $apx->tmpl->assign('LINK', $linklist);
         $apx->tmpl->assign('ALLOWCOMS', (int) $_POST['allowcoms']);
         $apx->tmpl->assign('ALLOWNOTE', (int) $_POST['allownote']);
         $apx->tmpl->assign('SEARCHABLE', (int) $_POST['searchable']);
         $apx->tmpl->assign('RESTRICTED', (int) $_POST['restricted']);
         $apx->tmpl->assign('PUBNOW', (int) $_POST['pubnow']);
         $apx->tmpl->assign('ACTION', 'add');
         $apx->tmpl->parse('add_edit');
     }
 }