示例#1
0
 function announce_edit()
 {
     global $set, $apx, $db;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     $apx->lang->dropaction('forum', 'announce_edit');
     //Forum-Liste
     if (!is_array($_POST['forumid']) || $_POST['forumid'][0] == 'all') {
         $_POST['forumid'] = array('all');
     }
     //Absenden
     if ($_POST['send']) {
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!count($_POST['forumid']) || !$_POST['title'] || !$_POST['text']) {
             infoNotComplete();
         } else {
             //Veröffentlichung
             $_POST['starttime'] = maketime(1);
             if ($_POST['starttime']) {
                 $_POST['endtime'] = maketime(2);
                 if (!$_POST['endtime'] || $_POST['endtime'] < $_POST['starttime']) {
                     $_POST['endtime'] = 3000000000;
                 }
             }
             //Ankündigung erstellen
             $db->dupdate(PRE . '_forum_announcements', 'title,text,starttime,endtime', "WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
             //Foren eintragen
             $db->query("DELETE FROM " . PRE . "_forum_anndisplay WHERE id='" . $_REQUEST['id'] . "'");
             if ($_POST['forumid'][0] == 'all') {
                 $db->query("\n\t\t\t\t\tINSERT IGNORE INTO " . PRE . "_forum_anndisplay\n\t\t\t\t\tVALUES ('" . $_REQUEST['id'] . "', '0')\n\t\t\t\t");
             } else {
                 foreach ($_POST['forumid'] as $fid) {
                     $fid = (int) $fid;
                     if (!$fid) {
                         continue;
                     }
                     $db->query("\n\t\t\t\t\t\tINSERT IGNORE INTO " . PRE . "_forum_anndisplay\n\t\t\t\t\t\tVALUES ('" . $_REQUEST['id'] . "', '" . $fid . "')\n\t\t\t\t\t");
                 }
             }
             logit('FORUM_ANNOUNCEADD', 'ID #' . $nid);
             printJSRedirect('action.php?action=forum.announce');
         }
     } else {
         $_POST = $db->first("SELECT title,text,starttime,endtime FROM " . PRE . "_forum_announcements WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
         //Forum-Ids auslesen
         $data = $db->fetch("SELECT forumid FROM " . PRE . "_forum_anndisplay WHERE id='" . $_REQUEST['id'] . "'");
         $_POST['forumid'] = array();
         foreach ($data as $res) {
             if ($res['forumid'] == 0) {
                 $_POST['forumid'] = array('all');
                 break;
             } else {
                 $_POST['forumid'][] = $res['forumid'];
             }
         }
         //Veröffentlichung
         if ($_POST['starttime']) {
             maketimepost(1, $_POST['starttime']);
             if ($_POST['endtime'] < 2147483647) {
                 maketimepost(2, $_POST['endtime']);
             }
         }
         //Foren auslesen
         $data = $this->cat->getTree(array('iscat', 'title', 'posts', 'threads'));
         $forumlist = '<option value="all" style="font-weight:bold;"' . iif(in_array('all', $_POST['forumid']), ' selected="selected"') . '>' . $apx->lang->get('ALLFORUMS') . '</option>';
         if (count($data)) {
             foreach ($data as $res) {
                 $space = str_repeat('&nbsp;&nbsp;', $res['level'] - 1);
                 if ($res['iscat']) {
                     $style = ' style="background:#EAEAEA"';
                 } else {
                     $style = '';
                 }
                 $forumlist .= '<option value="' . $res['forumid'] . '"' . $style . '' . iif(in_array($res['forumid'], $_POST['forumid']), ' selected="selected"') . '>' . $space . replace($res['title']) . '</option>';
             }
         }
         $apx->tmpl->assign('FORUMLIST', $forumlist);
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('STARTTIME', choosetime(1, 1, maketime(1)));
         $apx->tmpl->assign('ENDTIME', choosetime(2, 1, maketime(2)));
         $apx->tmpl->assign('ACTION', 'edit');
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->parse('announceadd_announceedit');
     }
 }
示例#2
0
 function enable()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     if ($_POST['send'] == 1) {
         $starttime = maketime(1);
         $endtime = maketime(2);
         if (!$endtime || $endtime <= $starttime) {
             $endtime = 3000000000;
         }
         if (!checkToken()) {
             return printInvalidToken();
         } elseif ($starttime) {
             $db->query("UPDATE " . PRE . "_banner SET starttime='" . $starttime . "',endtime='" . $endtime . "' WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
             logit('BANNER_ENABLE', 'ID #' . $_REQUEST['id']);
             printJSRedirect(get_index('banner.show'));
             return;
         }
     }
     list($title) = $db->first("SELECT partner FROM " . PRE . "_banner WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
     $apx->tmpl->assign('TITLE', compatible_hsc($title));
     $apx->tmpl->assign('ID', $_REQUEST['id']);
     $apx->tmpl->assign('STARTTIME', choosetime(1, 0, time()));
     $apx->tmpl->assign('ENDTIME', choosetime(2, 1));
     tmessageOverlay('enable');
 }
示例#3
0
 function enable()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     if ($_POST['send'] == 1) {
         $starttime = maketime(1);
         $endtime = maketime(2);
         if (!$endtime || $endtime <= $starttime) {
             $endtime = 3000000000;
         }
         $db->query("UPDATE " . PRE . "_poll SET starttime='" . $starttime . "',endtime='" . $endtime . "' WHERE ( id='" . $_REQUEST['id'] . "' ) LIMIT 1");
         logit('POLL_ENABLE', 'ID #' . $_REQUEST['id']);
         printJSRedirect(get_index('poll.show'));
     } else {
         list($title) = $db->first("SELECT question FROM " . PRE . "_poll WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('TITLE', compatible_hsc($title));
         $apx->tmpl->assign('STARTTIME', choosetime(1, 0, time()));
         $apx->tmpl->assign('ENDTIME', choosetime(2, 1));
         tmessageOverlay('enable', $input);
     }
 }
示例#4
0
 function enable()
 {
     global $set, $db, $apx;
     //Mehrere
     if (is_array($_REQUEST['multiid'])) {
         if (!checkToken()) {
             printInvalidToken();
         } else {
             $cache = array_map('intval', $_REQUEST['multiid']);
             if (!count($cache)) {
                 header("HTTP/1.1 301 Moved Permanently");
                 header('Location: ' . get_index('videos.show'));
                 return;
             }
             $data = $db->fetch("SELECT id FROM " . PRE . "_videos WHERE ( id IN (" . implode(',', $cache) . ") " . iif(!$apx->user->has_spright('videos.enable'), " AND userid='" . $apx->user->info['userid'] . "'") . " )");
             $cache = array();
             if (!is_array($data) || !count($data)) {
                 header("HTTP/1.1 301 Moved Permanently");
                 header('Location: ' . get_index('videos.show'));
                 return;
             }
             foreach ($data as $res) {
                 $cache[] = $res['id'];
             }
             if (!count($cache)) {
                 header("HTTP/1.1 301 Moved Permanently");
                 header('Location: ' . get_index('videos.show'));
                 return;
             }
             $db->query("UPDATE " . PRE . "_videos SET starttime='" . time() . "',endtime='3000000000' WHERE id IN (" . implode(',', $cache) . ")");
             foreach ($cache as $id) {
                 logit('VIDEOS_ENABLE', 'ID #' . $id);
             }
             header("HTTP/1.1 301 Moved Permanently");
             header('Location: ' . get_index('videos.show'));
         }
     } else {
         $_REQUEST['id'] = (int) $_REQUEST['id'];
         if (!$_REQUEST['id']) {
             die('missing ID!');
         }
         if ($_POST['send'] == 1) {
             $starttime = maketime(1);
             $endtime = maketime(2);
             if (!$endtime || $endtime <= $starttime) {
                 $endtime = 3000000000;
             }
             $db->query("UPDATE " . PRE . "_videos SET starttime='" . $starttime . "',endtime='" . $endtime . "' WHERE ( id='" . $_REQUEST['id'] . "' " . iif(!$apx->user->has_spright('videos.enable'), " AND userid='" . $apx->user->info['userid'] . "'") . " ) LIMIT 1");
             logit('VIDEOS_ENABLE', 'ID #' . $_REQUEST['id']);
             printJSRedirect(get_index('videos.show'));
         } else {
             list($title) = $db->first("SELECT title FROM " . PRE . "_videos WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
             $apx->tmpl->assign('TITLE', compatible_hsc($title));
             $apx->tmpl->assign('ID', $_REQUEST['id']);
             $apx->tmpl->assign('STARTTIME', choosetime(1, 0, time()));
             $apx->tmpl->assign('ENDTIME', choosetime(2, 1));
             tmessageOverlay('enable');
         }
     }
 }
示例#5
0
 function enable()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             printInvalidToken();
         } else {
             $starttime = maketime(1);
             $endtime = maketime(2);
             if (!$endtime || $endtime <= $starttime) {
                 $endtime = 3000000000;
             }
             $db->query("UPDATE " . PRE . "_news SET starttime='" . $starttime . "',endtime='" . $endtime . "' WHERE ( id='" . $_REQUEST['id'] . "' " . iif(!$apx->user->has_spright('news.enable'), " AND userid='" . $apx->user->info['userid'] . "'") . " ) LIMIT 1");
             logit('NEWS_ENABLE', 'ID #' . $_REQUEST['id']);
             printJSRedirect(get_index('news.show'));
         }
     } else {
         list($title, $subtitle) = $db->first("SELECT title, subtitle FROM " . PRE . "_news WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('TITLE', compatible_hsc($title . ($subtitle ? ' - ' . $subtitle : '')));
         $apx->tmpl->assign('STARTTIME', choosetime(1, 0, time()));
         $apx->tmpl->assign('ENDTIME', choosetime(2, 1));
         tmessageOverlay('enable');
     }
 }
示例#6
0
 function enable()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             printInvalidToken();
         } else {
             $starttime = maketime(1);
             $endtime = maketime(2);
             if (!$endtime || $endtime <= $starttime) {
                 $endtime = 3000000000;
             }
             //Elternknoten ebenfalls aktivieren
             $path = $this->cat->getPathTo(array('starttime'), $_REQUEST['id']);
             foreach ($path as $res) {
                 if (!$res['starttime']) {
                     $db->query("UPDATE " . PRE . "_gallery SET starttime='" . $starttime . "',endtime='" . $endtime . "' WHERE id='" . $res['id'] . "' LIMIT 1");
                     logit('GALLERY_ENABLE', 'ID #' . $res['id']);
                 }
             }
             printJSRedirect(get_index('gallery.show'));
         }
     } else {
         list($title) = $db->first("SELECT title FROM " . PRE . "_gallery WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('TITLE', compatible_hsc($title));
         $apx->tmpl->assign('STARTTIME', choosetime(1, 0, time()));
         $apx->tmpl->assign('ENDTIME', choosetime(2, 1));
         tmessageOverlay('enable');
     }
 }