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(' ', 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&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'] = ' '; } $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']); }
function mkdate($time = false, $conn = false) { global $set; if ($conn === false) { $conn = $set['main']['conndatetime']; } if ($time === false) { $time = time(); } return apxdate($time) . $conn . apxtime($time); }
function show_print($data) { global $set, $db, $apx, $html; $col[] = array(' ', 1, ''); $col[] = array(' ', 1, ''); $col[] = array('COL_TITLE', 70, 'class="title"'); $col[] = array('COL_HITS', 10, 'align="center"'); $col[] = array('COL_ADDTIME', 20, 'align="center"'); if (count($data)) { foreach ($data as $res) { ++$i; $link = mklink('products.php?id=' . $res['id'], 'products,id' . $res['id'] . urlformat($res['title']) . '.html'); //Aktiv-Anzeige if ($res['active']) { $tabledata[$i]['COL1'] = '<img src="design/greendot.gif" alt="' . $apx->lang->get('CORE_ACTIVE') . '" title="' . $apx->lang->get('CORE_ACTIVE') . '" />'; } else { $tabledata[$i]['COL1'] = '<img src="design/reddot.gif" alt="' . $apx->lang->get('CORE_INACTIVE') . '" title="' . $apx->lang->get('CORE_INACTIVE') . '" />'; } $tabledata[$i]['COL2'] = '<img src="design/type_' . $res['type'] . '.gif" alt="' . $apx->lang->get('PRODTYPE_' . strtoupper($res['type'])) . '" title="' . $apx->lang->get('PRODTYPE_' . strtoupper($res['type'])) . '" />'; $tabledata[$i]['COL3'] = '<a href="' . $link . '" target="_blank">' . $res['title'] . '</a>'; $tabledata[$i]['COL4'] = number_format($res['hits'], 0, '', '.'); $tabledata[$i]['COL5'] = apxdate($res['addtime']); //Optionen if ($apx->user->has_right('products.edit')) { $tabledata[$i]['OPTIONS'] .= optionHTML('edit.gif', 'products.edit', 'id=' . $res['id'], $apx->lang->get('CORE_EDIT')); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } if ($apx->user->has_right('products.del')) { $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('del.gif', 'products.del', 'id=' . $res['id'], $apx->lang->get('CORE_DEL')); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } if ($res['active'] && $apx->user->has_right('products.disable')) { $tabledata[$i]['OPTIONS'] .= optionHTML('disable.gif', 'products.disable', 'id=' . $res['id'] . '§oken=' . $apx->session->get('sectoken'), $apx->lang->get('CORE_DISABLE')); } elseif (!$res['active'] && $apx->user->has_right('products.enable')) { $tabledata[$i]['OPTIONS'] .= optionHTML('enable.gif', 'products.enable', 'id=' . $res['id'] . '§oken=' . $apx->session->get('sectoken'), $apx->lang->get('CORE_ENABLE')); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } //Kommentare + Bewertungen if ($apx->is_module('comments') || $apx->is_module('ratings')) { $tabledata[$i]['OPTIONS'] .= ' '; } if ($apx->is_module('comments')) { list($comments) = $db->first("SELECT count(id) FROM " . PRE . "_comments WHERE ( module='products' AND mid='" . $res['id'] . "' )"); if ($comments && ($apx->is_module('comments') && $set['products']['coms']) && $res['allowcoms'] && $apx->user->has_right('comments.show')) { $tabledata[$i]['OPTIONS'] .= optionHTML('comments.gif', 'comments.show', 'module=products&mid=' . $res['id'], $apx->lang->get('COMMENTS') . ' (' . $comments . ')'); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } } if ($apx->is_module('ratings')) { list($ratings) = $db->first("SELECT count(id) FROM " . PRE . "_ratings WHERE ( module='products' AND mid='" . $res['id'] . "' )"); if ($ratings && ($apx->is_module('ratings') && $set['products']['ratings']) && $res['allowrating'] && $apx->user->has_right('ratings.show')) { $tabledata[$i]['OPTIONS'] .= optionHTML('ratings.gif', 'ratings.show', 'module=products&mid=' . $res['id'], $apx->lang->get('RATINGS') . ' (' . $ratings . ')'); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } } } } $apx->tmpl->assign('TABLE', $tabledata); $html->table($col); }
function stats() { global $set, $db, $apx; $datestamp = date('Ymd', time() - TIMEDIFF); list($count_files) = $db->first("SELECT count(id) FROM " . PRE . "_videos WHERE starttime!='0'"); $count_dlsperday = $this->stats_dlsperday(); $count_sizeperday = $this->stats_sizeperday(); list($count_all, $size[0]) = $db->first("SELECT sum(hits),sum(bytes*hits) FROM " . PRE . "_videos_stats"); list($count_week, $size[1]) = $db->first("SELECT sum(hits),sum(bytes*hits) FROM " . PRE . "_videos_stats WHERE daystamp BETWEEN '" . date('Ymd', time() - 6 * 24 * 3600 - TIMEDIFF) . "' AND '" . date('Ymd', time() - TIMEDIFF) . "'"); list($count_today, $size[2]) = $db->first("SELECT sum(hits),sum(bytes*hits) FROM " . PRE . "_videos_stats WHERE daystamp='" . date('Ymd', time() - TIMEDIFF) . "'"); $apx->tmpl->assign('FILES', $count_files); $apx->tmpl->assign('DLS_PERDAY', $count_dlsperday); $apx->tmpl->assign('SIZE_PERDAY', $count_sizeperday); $apx->tmpl->assign('DLS_ALL', (int) $count_all); $apx->tmpl->assign('DLS_WEEK', (int) $count_week); $apx->tmpl->assign('DLS_TODAY', (int) $count_today); $apx->tmpl->assign('SIZE_ALL', $this->format_size($size[0])); $apx->tmpl->assign('SIZE_WEEK', $this->format_size($size[1])); $apx->tmpl->assign('SIZE_TODAY', $this->format_size($size[2])); //Die letzten 50 Tage if ($_REQUEST['show'] == 'size') { $data = $db->fetch("SELECT sum(bytes*hits) AS count,daystamp,time FROM " . PRE . "_videos_stats WHERE daystamp>='" . date('Ymd', time() - 50 * 24 * 3600 - TIMEDIFF) . "' GROUP BY daystamp ORDER BY daystamp ASC"); $apx->tmpl->assign('GRAPH_HEADLINE', $apx->lang->get('TRAFFIC')); } else { $data = $db->fetch("SELECT sum(hits) AS count,daystamp,time FROM " . PRE . "_videos_stats WHERE daystamp>='" . date('Ymd', time() - 50 * 24 * 3600 - TIMEDIFF) . "' GROUP BY daystamp ORDER BY daystamp ASC"); $apx->tmpl->assign('GRAPH_HEADLINE', $apx->lang->get('DOWNLOADS')); } if (count($data)) { //Maximum holen foreach ($data as $res) { if ($res['count'] > $max) { $max = $res['count']; } } //Base generieren if ($_REQUEST['show'] == 'size') { if (strlen($max) > 3) { $pot = floor(strlen($max) / 3); $multi = floor(strlen($max) % 3); if ($multi == 0) { --$pot; $multi = 3; } for ($i = 1; $i <= 10; $i++) { $base = pow(1024, $pot) * pow(10, $multi - 1) * $i; if ($base >= $max) { break; } } } else { for ($i = 1; $i <= 10; $i++) { $base = pow(10, strlen($max) - 1) * $i; if ($base >= $max) { break; } } } $apx->tmpl->assign('SCALE1', $this->format_size(round($base / 4), 0)); $apx->tmpl->assign('SCALE2', $this->format_size(round($base / 4 * 2), 0)); $apx->tmpl->assign('SCALE3', $this->format_size(round($base / 4 * 3), 0)); $apx->tmpl->assign('SCALE4', $this->format_size(round($base), 0)); } else { if (strlen($max) > 1) { for ($i = 1; $i <= 10; $i++) { $base = pow(10, strlen($max) - 1) * $i; if ($base >= $max) { break; } } } else { $base = $max; } $apx->tmpl->assign('SCALE1', round($base / 4)); $apx->tmpl->assign('SCALE2', round($base / 4 * 2)); $apx->tmpl->assign('SCALE3', round($base / 4 * 3)); $apx->tmpl->assign('SCALE4', $base); } //Statistik generieren foreach ($data as $res) { ++$i; if ($_REQUEST['show'] == 'size') { $info = $this->format_size($res['count']); } else { $info = $res['count'] . ' ' . $apx->lang->get('HITS'); } $statdata[$i]['DATE'] = apxdate($res['time']); $statdata[$i]['INFO'] = $info; $statdata[$i]['COUNT'] = $res['count']; $statdata[$i]['HEIGHT'] = round($res['count'] / $base * 299); } } //Beliebteste Videos $data = $db->fetch("SELECT sum(a.hits) AS count,b.id,b.title FROM " . PRE . "_videos_stats AS a LEFT JOIN " . PRE . "_videos AS b ON a.dlid=b.id WHERE time BETWEEN '" . (time() - 7 * 24 * 3600) . "' AND '" . time() . "' GROUP BY dlid ORDER BY count DESC LIMIT 20"); if (count($data)) { foreach ($data as $res) { ++$i; $popdata[$i]['COUNT'] = $res['count']; $popdata[$i]['TITLE'] = strip_tags($res['title']); $popdata[$i]['LINK'] = mklink('videos.php?id=' . $res['id'], 'videos,id' . $res['id'] . urlformat($res['title']) . '.html', iif($set['main']['forcesection'], iif(unserialize_section($res['secid']) == array('all'), $apx->section_default, array_shift($tmp = unserialize_section($res['secid']))), 0)); } } $apx->tmpl->assign('STAT', $statdata); $apx->tmpl->assign('POP', $popdata); $apx->tmpl->parse('stats'); }
function show_print($data) { global $set, $db, $apx, $html; $col[] = array('', 1, 'align="center"'); $col[] = array($apx->lang->get('COL_TITLE') . ' / ' . $apx->lang->get('COL_USER'), 55, 'class="title"'); $col[] = array('COL_CATEGORY', 20, 'align="center"'); $col[] = array('COL_STARTEND', 15, 'align="center"'); $col[] = array('COL_HITS', 10, 'align="center"'); if (count($data)) { foreach ($data as $res) { ++$i; if ($res['active']) { $tabledata[$i]['COL1'] = '<img src="design/greendot.gif" alt="' . $apx->lang->get('CORE_ACTIVE') . '" title="' . $apx->lang->get('CORE_ACTIVE') . '" />'; } else { $tabledata[$i]['COL1'] = '<img src="design/reddot.gif" alt="' . $apx->lang->get('CORE_INACTIVE') . '" title="' . $apx->lang->get('CORE_INACTIVE') . '" />'; } $tmp = unserialize_section($res['secid']); $link = mklink('events.php?id=' . $res['id'], 'events,id' . $res['id'] . urlformat($res['title']) . '.html', iif($set['main']['forcesection'], iif(unserialize_section($res['secid']) == array('all'), $apx->section_default, array_shift($tmp)), 0)); $tabledata[$i]['COL2'] = '<a href="' . $link . '" target="_blank">' . shorttext(strip_tags($res['title']), 40) . '</a>'; if ($res['username']) { $tabledata[$i]['COL2'] .= '<br /><small>' . $apx->lang->get('BY') . ' ' . replace($res['username']) . '</small>'; } else { $tabledata[$i]['COL2'] .= '<br /><small>' . $apx->lang->get('BY') . ' ' . $apx->lang->get('GUEST') . ': <i>' . replace($res['send_username']) . '</i></small>'; } $col3 = apxdate($this->stamp2time($res['startday'])); if ($res['endday'] != $res['startday']) { $col3 .= '<br />' . apxdate($this->stamp2time($res['endday'])); } $tabledata[$i]['COL3'] = replace($res['catname']); $tabledata[$i]['COL4'] = $col3; $tabledata[$i]['COL5'] = number_format($res['hits'], 0, '', '.'); //Optionen if ($apx->user->has_right('calendar.edit')) { $tabledata[$i]['OPTIONS'] .= optionHTML('edit.gif', 'calendar.edit', 'id=' . $res['id'], $apx->lang->get('CORE_EDIT')); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } if ($apx->user->has_right('calendar.copy') && ($res['userid'] == $apx->user->info['userid'] || $apx->user->has_spright('calendar.copy'))) { $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('copy.gif', 'calendar.copy', 'id=' . $res['id'], $apx->lang->get('COPY')); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } if ($apx->user->has_right('calendar.del')) { $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('del.gif', 'calendar.del', 'id=' . $res['id'], $apx->lang->get('CORE_DEL')); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } if ($apx->user->has_right('calendar.enable') && !$res['active']) { $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('enable.gif', 'calendar.enable', 'id=' . $res['id'], $apx->lang->get('CORE_ENABLE')); } elseif ($apx->user->has_right('calendar.disable') && $res['active']) { $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('disable.gif', 'calendar.disable', 'id=' . $res['id'], $apx->lang->get('CORE_ENABLE')); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } //Kommentare if ($apx->is_module('comments')) { $tabledata[$i]['OPTIONS'] .= ' '; list($comments) = $db->first("SELECT count(id) FROM " . PRE . "_comments WHERE ( module='calendar' AND mid='" . $res['id'] . "' )"); if ($comments && ($apx->is_module('comments') && $set['calendar']['coms']) && $res['allowcoms'] && $apx->user->has_right('comments.show')) { $tabledata[$i]['OPTIONS'] .= optionHTML('comments.gif', 'comments.show', 'module=calendar&mid=' . $res['id'], $apx->lang->get('COMMENTS') . ' (' . $comments . ')'); } else { $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />'; } } } } $apx->tmpl->assign('TABLE', $tabledata); $html->table($col); }