Example #1
0
 function show()
 {
     global $set, $db, $apx, $html;
     quicklink_multi('newsletter.add');
     if ($apx->is_module('news')) {
         quicklink_multi('newsletter.addnews');
     }
     quicklink_out();
     list($rec) = $db->first("\n\t\tSELECT count(DISTINCT eid)\n\t\tFROM " . PRE . "_newsletter_emails AS ne\n\t\tJOIN " . PRE . "_newsletter_emails_cat AS nec ON ne.id=nec.eid\n\t\tWHERE active=1\n\t");
     echo '<p class="hint">' . $apx->lang->get('CURRENTREC') . ': ' . number_format($rec, 0, '', '.') . '</p>';
     $orderdef[0] = 'addtime';
     $orderdef['subject'] = array('subject', 'ASC', 'COL_SUBJECT');
     $orderdef['addtime'] = array('addtime', 'DESC', 'SORT_ADDTIME');
     $orderdef['sendtime'] = array('sendtime', 'DESC', 'COL_SENDTIME');
     $col[] = array('&nbsp;', 1, '');
     $col[] = array('COL_SUBJECT', 50, 'class="title"');
     $col[] = array('COL_CATEGORY', 30, 'align="center"');
     $col[] = array('COL_SENDTIME', 20, 'align="center"');
     list($count) = $db->first("SELECT count(id) FROM " . PRE . "_newsletter");
     pages('action.php?action=newsletter.show&amp;sortby=' . $_REQUEST['sortby'], $count);
     $data = $db->fetch("SELECT id,catid,subject,done,sendtime FROM " . PRE . "_newsletter " . getorder($orderdef) . getlimit());
     if (count($data)) {
         foreach ($data as $res) {
             ++$i;
             if ($res['done']) {
                 $tabledata[$i]['COL1'] = '<img src="design/check.gif" alt="' . $apx->lang->get('ISSEND') . '" title="' . $apx->lang->get('ISSEND') . '" />';
             } else {
                 $tabledata[$i]['COL1'] = '&nbsp;';
             }
             $tabledata[$i]['COL2'] = replace($res['subject']);
             $tabledata[$i]['COL3'] = replace($set['newsletter']['categories'][$res['catid']]);
             $tabledata[$i]['COL4'] = iif($res['sendtime'], apxdate($res['sendtime']), '-');
             //Optionen
             if ($apx->user->has_right('newsletter.edit')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTML('edit.gif', 'newsletter.edit', 'id=' . $res['id'], $apx->lang->get('CORE_EDIT'));
             } else {
                 $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
             }
             if ($apx->user->has_right('newsletter.del')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('del.gif', 'newsletter.del', 'id=' . $res['id'], $apx->lang->get('CORE_EDIT'));
             } else {
                 $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
             }
             if ($apx->user->has_right('newsletter.send')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('emailsend.gif', 'newsletter.send', 'id=' . $res['id'], $apx->lang->get('SEND'));
             } else {
                 $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
             }
             if ($apx->user->has_right('newsletter.preview')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('emailpreview.gif', 'newsletter.preview', 'id=' . $res['id'], $apx->lang->get('PREVIEW'));
             } else {
                 $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
             }
         }
     }
     $apx->tmpl->assign('TABLE', $tabledata);
     $html->table($col);
     orderstr($orderdef, 'action.php?action=newsletter.show');
     save_index($_SERVER['REQUEST_URI']);
 }
Example #2
0
 function blockcontent()
 {
     global $set, $db, $apx, $html;
     $_REQUEST['key'] = (int) $_REQUEST['key'];
     //IP löschen
     if ($_REQUEST['do'] == 'del') {
         if ($_POST['send']) {
             if (!checkToken()) {
                 printInvalidToken();
             } else {
                 unset($set['guestbook']['blockstring'][$_REQUEST['id']]);
                 $db->query("UPDATE " . PRE . "_config SET value='" . addslashes(serialize($set['guestbook']['blockstring'])) . "' WHERE module='guestbook' AND varname='blockstring' LIMIT 1");
                 printJSRedirect('action.php?action=guestbook.blockcontent');
             }
         } else {
             $apx->tmpl->assign('MESSAGE', $apx->lang->get('MSG_DEL', array('TITLE' => compatible_hsc($set['guestbook']['blockstring'][$_REQUEST['id']]))));
             tmessageOverlay('contentdel', array('ID' => $_REQUEST['id']));
         }
         return;
     } elseif ($_REQUEST['do'] == 'add') {
         if (!checkToken()) {
             printInvalidToken();
         } elseif (!$_POST['string']) {
             infoNotComplete();
         } else {
             $set['guestbook']['blockstring'][] = $_POST['string'];
             $db->query("UPDATE " . PRE . "_config SET value='" . addslashes(serialize($set['guestbook']['blockstring'])) . "' WHERE module='guestbook' AND varname='blockstring' LIMIT 1");
             printJSRedirect('action.php?action=guestbook.blockcontent');
         }
         return;
     }
     quicklink_index('guestbook.show');
     quicklink_out();
     //AUFLISTUNG BEGINNT
     $strings = $set['guestbook']['blockstring'];
     if (!is_array($strings)) {
         $strings = array();
     }
     $strings = array_sort($strings, 0, 'asc');
     $col[] = array('TITLE_GUESTBOOK_BLOCKCONTENT', 100, 'class="title"');
     foreach ($strings as $i => $res) {
         $tabledata[$i]['COL1'] = $res;
         $tabledata[$i]['OPTIONS'] = optionHTMLOverlay('del.gif', 'guestbook.blockcontent', 'do=del&id=' . $i, $apx->lang->get('CORE_DEL'));
     }
     $apx->tmpl->assign('TABLE', $tabledata);
     $html->table($col);
     $apx->tmpl->parse('blockcontent');
 }
Example #3
0
 function index()
 {
     global $set, $apx, $db, $html;
     $ftype = $this->getftype();
     $opendir = BASEDIR . getpath('uploads') . $_REQUEST['dir'];
     $parentdirs = explode('/', $_REQUEST['dir']);
     //Einrücken
     if (!$_REQUEST['dir']) {
         $space = 0;
     } else {
         $space = count($parentdirs);
     }
     //MUTTERVERZEICHNISSE AUSGEBEN
     if (count($parentdirs)) {
         foreach ($parentdirs as $currentdir) {
             if ($currentdir == '') {
                 continue;
             }
             ++$i;
             $mkpath[] = $currentdir;
             $parentdata[$i]['NAME'] = $currentdir;
             $parentdata[$i]['LINK'] = 'action.php?action=mediamanager.index&dir=' . implode('/', $mkpath) . '&amp;module=' . $this->module;
         }
         $apx->tmpl->assign('PARENT', $parentdata);
         //Spacer für folgende Dateiauflistung festlegen
         $spacer = str_repeat('<img src="design/mm/spacer.gif" alt="" style="vertical-align:middle;" />', $space);
     }
     //Dateien auslesen
     $dirs = array();
     $files = array();
     $listdir = opendir($opendir);
     if (!$listdir) {
         die('can not access directory!');
     }
     while ($file = readdir($listdir)) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         if (!strpos('.', $file) && is_dir($opendir . '/' . $file)) {
             $dirs[] = $file;
         } else {
             $files[] = array($file, $this->mm->getext($file));
         }
     }
     closedir($listdir);
     //Ordner/Dateien sortieren
     natcasesort($dirs);
     $sortby = explode('.', $_REQUEST['sortby']);
     if ($sortby[0] == 'change') {
         //Letzte Änderung auslesen
         foreach ($files as $key => $value) {
             $files[$key][] = filemtime(BASEDIR . getpath('uploads') . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $value[0]);
         }
         $files = array_sort($files, 2, $sortby[1]);
     } else {
         $files = array_sort($files, 0, $sortby[1]);
     }
     //OBEJKT-INDEX
     $objcount = count($dirs) + count($files);
     if ($objcount) {
         //ORDNER AUSGEBEN
         if (count($dirs)) {
             foreach ($dirs as $file) {
                 ++$obj;
                 if ($obj == $objcount) {
                     $dirdata[$obj]['NODE'] = '<img src="design/mm/closed_end.gif" alt="" style="vertical-align:middle;" />';
                 } else {
                     $dirdata[$obj]['NODE'] = '<img src="design/mm/closed.gif" alt="" style="vertical-align:middle;" />';
                 }
                 $dirdata[$obj]['IMG'] = '<img src="design/mm/folder_closed.gif" alt="" style="vertical-align:middle;" />';
                 $dirdata[$obj]['NAME'] = $file;
                 $dirdata[$obj]['LINK'] = 'action.php?action=mediamanager.index&dir=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . "/") . $file . '&amp;module=' . $this->module;
                 if ($apx->user->has_right('mediamanager.dirrename')) {
                     $dirdata[$obj]['OPTIONS'] .= optionHTMLOverlay('rename.gif', 'mediamanager.dirrename', 'dir=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file . '&module=' . $this->module, $apx->lang->get('RENAME'));
                 } else {
                     $filedata[$obj]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
                 }
             }
             $apx->tmpl->assign('DIR', $dirdata);
         }
         //DATEIEN AUSGEBEN
         if (count($files)) {
             foreach ($files as $file) {
                 ++$obj;
                 list($filename, $extension) = $file;
                 $filedata[$obj]['ID'] = iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file[0];
                 $filedata[$obj]['NAME'] = $filename;
                 $filedata[$obj]['MFUNC'] = '';
                 if ($apx->user->has_right('mediamanager.details')) {
                     $filedata[$obj]['NAME'] = '<a href="action.php?action=mediamanager.details&amp;file=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file[0] . '&amp;module=' . $this->module . '">' . $file[0] . '</a>';
                 }
                 if (array_key_exists($extension, $ftype)) {
                     $filedata[$obj]['IMG'] = $ftype[$extension]['img'];
                 } else {
                     $filedata[$obj]['IMG'] = $ftype['#UNKNOWN#']['img'];
                 }
                 //Modul-Name
                 $modulename = $this->module;
                 if (strpos($this->module, ':') !== false) {
                     $mp = explode(':', $this->module, 2);
                     $modulename = $mp[0];
                     $inputids = explode(',', $mp[1]);
                     $inputids = array_map('intval', $inputids);
                 }
                 //Modul-Funktionen
                 if ($modulename && isset($apx->modules[$modulename]['mediainput']) && is_array($apx->modules[$modulename]['mediainput']) && count($apx->modules[$modulename]['mediainput'])) {
                     $funccache = array();
                     $apx->lang->drop('media', $modulename);
                     foreach ($apx->modules[$modulename]['mediainput'] as $key => $func) {
                         //Nur bestimmte Inputs
                         if (is_array($inputids) && count($inputids)) {
                             if (!in_array($key, $inputids)) {
                                 continue;
                             }
                         }
                         if (is_array($func['filetype']) && count($func['filetype']) && !in_array($extension, $func['filetype'])) {
                             continue;
                         }
                         if ($func['urlrel'] == 'base') {
                             $url = getpath('uploads') . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file[0];
                         } elseif ($func['urlrel'] == 'absolute') {
                             $url = BASEIDIR . getpath('uploads') . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file[0];
                         } elseif ($func['urlrel'] == 'httpdir') {
                             $url = HTTPDIR . getpath('uploads') . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file[0];
                         } elseif ($func['urlrel'] == 'http') {
                             $url = HTTP . getpath('uploads') . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file[0];
                         } elseif ($func['urlrel'] == 'uploads') {
                             $url = iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file[0];
                         } else {
                             die('unknown URLREL: ' . $func['urlrel']);
                         }
                         $funcRepl = array('{PATH}' => $url, '{FUNCNUM}' => $apx->session->get('CKEditorFuncNum') ? $apx->session->get('CKEditorFuncNum') : 1);
                         $funccache[] = '<a href="javascript:' . strtr($func['function'], $funcRepl) . '">' . $apx->lang->insertpack($func['icon']) . '</a>';
                     }
                     $filedata[$obj]['MFUNC'] = implode(' ', $funccache);
                 }
                 //Optionen
                 if ($apx->user->has_right('mediamanager.copy')) {
                     $filedata[$obj]['OPTIONS'] .= optionHTMLOverlay('copy.gif', 'mediamanager.copy', 'file=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $filename . '&module=' . $this->module, $apx->lang->get('COPY'));
                 } else {
                     $filedata[$obj]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
                 }
                 if ($apx->user->has_right('mediamanager.move') && $ftype[$extension]['special'] != "undel") {
                     $filedata[$obj]['OPTIONS'] .= optionHTMLOverlay('move.gif', 'mediamanager.move', 'file=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $filename . '&module=' . $this->module, $apx->lang->get('MOVE'));
                 } else {
                     $filedata[$obj]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
                 }
                 if ($apx->user->has_right('mediamanager.rename') && $ftype[$extension]['special'] != "undel") {
                     $filedata[$obj]['OPTIONS'] .= optionHTMLOverlay('rename.gif', 'mediamanager.rename', 'file=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $filename . '&module=' . $this->module, $apx->lang->get('RENAME'));
                 } else {
                     $filedata[$obj]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
                 }
                 if ($apx->user->has_right('mediamanager.del') && $ftype[$extension]['special'] != "undel") {
                     $filedata[$obj]['OPTIONS'] .= optionHTMLOverlay('del.gif', 'mediamanager.del', 'file=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $filename . '&module=' . $this->module, $apx->lang->get('CORE_DEL'));
                 } else {
                     $filedata[$obj]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
                 }
                 if ($apx->user->has_right('mediamanager.thumb') && in_array($extension, array('GIF', 'JPG', 'JPEG', 'JPE', 'PNG'))) {
                     $filedata[$obj]['OPTIONS'] .= optionHTMLOverlay('pic.gif', 'mediamanager.thumb', 'file=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $filename . '&module=' . $this->module, $apx->lang->get('THUMB'));
                 } else {
                     $filedata[$obj]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
                 }
             }
             $apx->tmpl->assign('FILE', $filedata);
         }
     } else {
         $text = $apx->lang->get('NONE');
         if ($apx->user->has_right('mediamanager.dirdel') && $_REQUEST['dir']) {
             $text .= '<br />&raquo; <a href="javascript:MessageOverlayManager.createLayer(\'action.php?action=mediamanager.dirdel&dir=' . $_REQUEST['dir'] . '&amp;module=' . $this->module . '\');">' . $apx->lang->get('DIRDEL') . '</a> &laquo;';
         }
         $apx->tmpl->assign('NONE', $text);
     }
     //Quicklinks
     quicklink_multi('mediamanager.diradd', 'action.php', 'dir=' . $_REQUEST['dir'] . '&amp;module=' . $this->module);
     quicklink_multi('mediamanager.upload', 'action.php', 'dir=' . $_REQUEST['dir'] . '&amp;module=' . $this->module);
     quicklink_multi('mediamanager.sts', 'action.php', 'dir=' . $_REQUEST['dir'] . '&amp;module=' . $this->module);
     quicklink_out();
     $multiactions = array();
     if ($apx->user->has_right('mediamanager.del')) {
         $multiactions[] = array($apx->lang->get('CORE_DEL'), 'action.php?action=mediamanager.del&module=' . $this->module, false);
     }
     if ($apx->user->has_right('mediamanager.copy')) {
         $multiactions[] = array($apx->lang->get('COPY'), 'action.php?action=mediamanager.copy&module=' . $this->module, true);
     }
     if ($apx->user->has_right('mediamanager.move')) {
         $multiactions[] = array($apx->lang->get('MOVE'), 'action.php?action=mediamanager.move&module=' . $this->module, true);
     }
     $html->assignfooter($multiactions);
     $apx->tmpl->parse('index');
     //Sortieren
     $orderdef[0] = 'file';
     $orderdef['file'] = array('NOTHING', 'ASC', 'SORT_FILE');
     $orderdef['change'] = array('CHANGE', 'DESC', 'SORT_LASTCHANGE');
     orderstr($orderdef, 'action.php?action=mediamanager.index&dir=' . $_REQUEST['dir'] . '&amp;module=' . $this->module);
     save_index($_SERVER['REQUEST_URI']);
 }