function gallery_pages($id) { global $set, $db, $apx, $user; $id = (int) $id; //Order by if ($set['gallery']['orderpics'] == 2) { $sortby = 'id ASC'; } else { $sortby = 'id DESC'; } $query = "SELECT id,caption,thumbnail FROM " . PRE . "_gallery_pics WHERE ( galid='" . $id . "' "; if (!$user->is_team_member()) { $query .= " AND active='1' "; } $query .= " ) ORDER BY " . $sortby; $data = $db->fetch($query); $pages = count($data); foreach ($data as $res) { ++$i; //Seitenzahlen $pagedata[$i]['NUMBER'] = $i; $pagedata[$i]['LINK'] = mklink('gallery.php?pic=' . $res['id'], 'gallery,pic' . $res['id'] . urlformat($res['caption']) . '.html'); //Nächste Seite if ($current['next'] === false) { $current['next'] = array('link' => mklink('gallery.php?pic=' . $res['id'], 'gallery,pic' . $res['id'] . urlformat($res['caption']) . '.html'), 'preview' => HTTPDIR . getpath('uploads') . $res['thumbnail']); } //Vorherige Seite if ($_REQUEST['pic'] == $res['id']) { $selected = $i; $current['next'] = false; if ($last) { $current['prev'] = array('link' => mklink('gallery.php?pic=' . $last['id'], 'gallery,pic' . $last['id'] . urlformat($last['caption']) . '.html'), 'preview' => HTTPDIR . getpath('uploads') . $last['thumbnail']); } } //Erste Seite if ($i == 1) { $link_first = mklink('gallery.php?pic=' . $res['id'], 'gallery,pic' . $res['id'] . urlformat($res['caption']) . '.html'); } //Letzte Seite if ($i == $pages) { $link_last = mklink('gallery.php?pic=' . $res['id'], 'gallery,pic' . $res['id'] . urlformat($res['caption']) . '.html'); } $last = $res; } $apx->tmpl->assign('PICTURE', $pagedata); $apx->tmpl->assign('PICTURE_COUNT', $pages); $apx->tmpl->assign('PICTURE_SELECTED', $selected); //Vorherige Seite if ($current['prev']) { $apx->tmpl->assign('PICTURE_PREVIOUS', $current['prev']['link']); $apx->tmpl->assign('PICTURE_PREVIOUS_PREVIEW', $current['prev']['preview']); } //Nächste Seite if ($current['next']) { $apx->tmpl->assign('PICTURE_NEXT', $current['next']['link']); $apx->tmpl->assign('PICTURE_NEXT_PREVIEW', $current['next']['preview']); } $apx->tmpl->assign('PICTURE_FIRST', $link_first); $apx->tmpl->assign('PICTURE_LAST', $link_last); }
function mediamanager_inline_code($ids) { global $set, $db, $apx; $tmpl = new tengine(); $data = $db->fetch("SELECT id,picture,popup,text,align FROM " . PRE . "_inlinescreens WHERE id IN (" . implode(',', $ids) . ")"); if (!count($data)) { array(); } //Codes generieren ob_start(); $code = array(); foreach ($data as $res) { if ($res['popup']) { $size = getimagesize(BASEDIR . getpath('uploads') . $res['popup']); $tmpl->assign('POPUP', "javascript:popuppic('misc.php?action=picture&pic=" . $res['popup'] . "','" . $size[0] . "','" . $size[1] . "',0);"); } $tmpl->assign('ID', $res['id']); $tmpl->assign('PICTURE', HTTPDIR . getpath('uploads') . $res['picture']); $tmpl->assign('FULLSIZE', HTTPDIR . getpath('uploads') . $res['popup']); $tmpl->assign('TEXT', $res['text']); $tmpl->assign('ALIGN', $res['align']); $tmpl->parse('inlinepic', 'main'); $imagecode = ob_get_contents(); ob_clean(); $code[$res['id']] = $imagecode; } ob_end_clean(); //Replacement $replace = array(); foreach ($ids as $id) { $replace['{IMAGE(' . $id . ')}'] = $code[intval($id)]; } return $replace; }
function langpath($module) { global $apx; if ($module == '/') { $this->langdir = getpath('lang_base', array('MODULE' => $module, 'LANGID' => $this->langid())); } else { $this->langdir = getpath('lang_modules', array('MODULE' => $module, 'LANGID' => $this->langid())); } }
function misc_picture() { global $set, $db, $apx; if (!$_REQUEST['pic']) { die('missing PIC!'); } $apx->tmpl->loaddesign('blank'); $apx->tmpl->assign('IMAGE', getpath('uploads') . $_REQUEST['pic']); $apx->tmpl->parse('showpic', 'main'); }
function misc_videofile() { global $set, $db, $apx, $user; $_REQUEST['id'] = (int) $_REQUEST['id']; if (!$_REQUEST['id']) { die('missing ID!'); } if ($set['videos']['regonly'] && !$user->info['userid']) { die('video only for registered users!'); } $apx->lang->drop('detail', 'videos'); //Secure Check $res = $db->first("SELECT id,title,file,regonly,`limit`,password,source FROM " . PRE . "_videos WHERE ( id='" . $_REQUEST['id'] . "' " . iif(!$user->is_team_member(), "AND ( '" . time() . "' BETWEEN starttime AND endtime )") . " " . section_filter() . " ) LIMIT 1"); if (!$res['id']) { die('file not found!'); } if ($res['regonly'] && !$user->info['userid']) { die('video only for registered users!'); } if (videos_limit_is_reached($res['id'], $res['limit'])) { message($apx->lang->get('MSG_LIMITREACHED'), 'back'); } if ($res['password'] && $_POST['password'] != $res['password']) { tmessage('pwdrequired', array('ID' => $_REQUEST['id'], 'SECHASH' => $_REQUEST['sechash']), 'videos'); } $checkhash = md5($_SERVER['HTTP_HOST'] . $res['file'] . date('Y/m/d', time() - TIMEDIFF)); if ($checkhash != $_REQUEST['sechash']) { header("HTTP/1.1 301 Moved Permanently"); header('location:' . str_replace('&', '&', mklink('videos.php?id=' . $_REQUEST['id'], 'videos,id' . $_REQUEST['id'] . urlformat($res['title']) . '.html'))); exit; } //Datei downloadbar? if (!in_array($res['source'], array('apexx', 'external'))) { header("HTTP/1.1 404 Not Found"); exit; } //Statistik $thefsize = videos_filesize($res); videos_insert_stats($res['id'], $thefsize, $res['source'] == 'apexx'); //Datei senden if ($res['source'] == 'external') { header("HTTP/1.1 301 Moved Permanently"); header('location:' . $res['file']); exit; } else { header("HTTP/1.1 301 Moved Permanently"); header('location:' . HTTPDIR . getpath('uploads') . $res['file']); exit; } }
function readout_dir($dirname) { $dirs = array(); $handle = opendir(BASEDIR . getpath('uploads') . $dirname); while ($file = readdir($handle)) { if ($file == '.' || $file == '..') { continue; } if (is_dir(BASEDIR . getpath('uploads') . iif($dirname, $dirname . '/') . $file)) { $dirs[] = $file; } } closedir($handle); return $dirs; }
function teaser_show($count = 0, $start = 0, $group = 0, $template = 'teaser') { global $set, $db, $apx; $count = (int) $count; $start = (int) $start; $group = (int) $group; $tmpl = new tengine(); $groupfilter = ''; if ($group) { $groupfilter = " AND `group`='" . $group . "'"; } if ($set['teaser']['orderby'] == 1) { $data = $db->fetch("SELECT id,title,text,link,image,hits FROM " . PRE . "_teaser WHERE '" . time() . "' BETWEEN starttime AND endtime " . $groupfilter . section_filter() . " ORDER BY ord ASC" . iif($count, " LIMIT " . iif($start, $start . ',') . $count)); } elseif ($set['teaser']['orderby'] == 2) { $data = $db->fetch("SELECT id,title,text,link,image,hits FROM " . PRE . "_teaser WHERE '" . time() . "' BETWEEN starttime AND endtime " . $groupfilter . section_filter() . " ORDER BY addtime DESC" . iif($count, " LIMIT " . iif($start, $start . ',') . $count)); } else { $data = $db->fetch("SELECT id,title,text,link,image,hits FROM " . PRE . "_teaser WHERE '" . time() . "' BETWEEN starttime AND endtime" . $groupfilter . section_filter()); if (count($data)) { srand((double) microtime() * 1000000); shuffle($data); if ($count) { foreach ($data as $res) { ++$ii; $newdata[] = $res; if ($ii == $count) { break; } } $data = $newdata; unset($newdata); } } } if (count($data)) { $apx->lang->drop('teaser', 'teaser'); foreach ($data as $res) { ++$i; $affdata[$i]['TITLE'] = $res['title']; $affdata[$i]['TEXT'] = $res['text']; $affdata[$i]['URL'] = $res['link']; $affdata[$i]['IMAGE'] = iif($res['image'], HTTPDIR . getpath('uploads') . $res['image']); $affdata[$i]['HITS'] = number_format($res['hits'], 0, '', '.'); $affdata[$i]['LINK'] = HTTPDIR . 'misc.php?action=teaserlink&id=' . $res['id']; } } $tmpl->assign('TEASER', $affdata); $tmpl->parse($template, 'teaser'); }
function products_pic($pic) { global $set, $db, $apx, $user; if (!$pic) { return array(); } $picture = getpath('uploads') . $pic; $poppic = str_replace('-thumb.', '.', $pic); if (strpos($pic, '-thumb.') !== false && file_exists(BASEDIR . getpath('uploads') . $poppic)) { $size = getimagesize(BASEDIR . getpath('uploads') . $poppic); $picture_popup = "javascript:popupwin('misc.php?action=picture&pic=" . $poppic . "','" . $size[0] . "','" . $size[1] . "')"; } else { $poppic = ''; } return array($picture, $picture_popup, iif($poppic, HTTPDIR . getpath('uploads') . $poppic)); }
public function upload($name = 'file') { $this->name = $name; if (!is_array($_FILES) || empty($_FILES) || !isset($_FILES[$this->name])) { return json_encode(array('code' => '-1', 'msg' => 'no upload file find')); } $code = 0; $msg = 'upload success'; if ($_FILES[$name]['error'] != 0) { $code = $_FILES[$name]['error']; switch ($_FILES[$name]['error']) { case 1: case 2: $msg = 'upload file size not allow'; break; case 3: $msg = 'File upload only partially'; break; case 4: $msg = 'No file was uploaded'; break; case 5: $msg = 'Upload file size is 0'; break; default: $msg = 'Unknown error'; break; } } if ($code != 0) { return json_encode(array('code' => $code, 'msg' => $msg)); } if (!is_uploaded_file($_FILES[$name]['tmp_name'])) { return json_encode(array('code' => -2, 'msg' => 'this file not uploaded file')); } if (!in_array(substr($_FILES[$name]['name'], strrpos($_FILES[$name]['name'], '.') + 1), $this->ext)) { return json_encode(array('code' => -2, 'msg' => 'this file extension not allow')); } $file = $this->file_path . md5(microtime()) . substr($_FILES[$name]['name'], strrpos($_FILES[$name]['name'], '.')); $ret = move_uploaded_file($_FILES[$name]['tmp_name'], $file); if (!$ret) { return json_encode(array('code' => -3, 'msg' => 'move uploaded file failed')); } else { return json_encode(array('code' => 0, 'msg' => 'upload success', 'file' => getpath($file))); } }
function affiliates_show($count = 0, $start = 0, $template = 'affiliates') { global $set, $db, $apx; $count = (int) $count; $start = (int) $start; $tmpl = new tengine(); if ($set['affiliates']['orderby'] == 1) { $data = $db->fetch("SELECT id,title,image,link,hits FROM " . PRE . "_affiliates WHERE active='1' ORDER BY ord ASC" . iif($count, " LIMIT " . iif($start, $start . ',') . $count)); } elseif ($set['affiliates']['orderby'] == 2) { $data = $db->fetch("SELECT id,title,image,link,hits FROM " . PRE . "_affiliates WHERE active='1' ORDER BY hits DESC" . iif($count, " LIMIT " . iif($start, $start . ',') . $count)); } elseif ($set['affiliates']['orderby'] == 3) { $data = $db->fetch("SELECT id,title,image,link,hits FROM " . PRE . "_affiliates WHERE active='1' ORDER BY hits ASC" . iif($count, " LIMIT " . iif($start, $start . ',') . $count)); } else { $data = $db->fetch("SELECT id,title,image,hits FROM " . PRE . "_affiliates WHERE active='1'"); if (count($data)) { srand((double) microtime() * 1000000); shuffle($data); if ($count) { foreach ($data as $res) { ++$ii; $newdata[] = $res; if ($ii == $count) { break; } } $data = $newdata; unset($newdata); } } } if (count($data)) { $apx->lang->drop('affiliates', 'affiliates'); foreach ($data as $res) { ++$i; $affdata[$i]['TITLE'] = $res['title']; $affdata[$i]['IMAGE'] = iif($res['image'], getpath('uploads') . $res['image']); $affdata[$i]['HITS'] = number_format($res['hits'], 0, '', '.'); $affdata[$i]['LINK'] = HTTPDIR . 'misc.php?action=afflink&id=' . $res['id']; $affdata[$i]['URL'] = $res['link']; } } $tmpl->assign('AFFILIATE', $affdata); $tmpl->parse($template, 'affiliates'); }
function cron_clean($lastexec) { global $set, $db, $apx; $now = time(); $db->query("DELETE FROM " . PRE . "_forum_activity WHERE time<='" . ($now - 3600) . "'"); //1 Stunde $db->query("DELETE FROM " . PRE . "_forum_search WHERE time<='" . ($now - 24 * 3600) . "'"); //24 Stunden //Anhänge löschen $data = $db->fetch("SELECT file FROM " . PRE . "_forum_attachments WHERE postid=0 AND time<='" . ($now - 24 * 3600) . "'"); if (count($data)) { foreach ($data as $res) { if (file_exists(BASEDIR . getpath('uploads') . $res['file'])) { @unlink(BASEDIR . getpath('uploads') . $res['file']); } } } $db->query("DELETE FROM " . PRE . "_forum_attachments WHERE postid=0 AND time<='" . ($now - 24 * 3600) . "'"); }
function cron_clear_cache($lastexec) { global $db, $set; $handle = opendir(BASEDIR . getpath('cache')); while ($file = readdir($handle)) { if ($file == '.' || $file == '..') { continue; } //Datei löschen, wenn älter als 7 Tage $lastchange = filemtime(BASEDIR . getpath('cache') . $file); if ($lastchange + 7 * 24 * 3600 + 3600 < time()) { //7 Tage + 1 Std. unlink(BASEDIR . getpath('cache') . $file); } } closedir($handle); //Captchas löschen $now = time(); $data = $db->fetch("SELECT hash FROM " . PRE . "_captcha WHERE time<=" . ($now - 3600)); $db->fetch("DELETE FROM " . PRE . "_captcha WHERE time<=" . ($now - 3600)); foreach ($data as $res) { @unlink(BASEDIR . getpath('uploads') . 'temp/captcha_' . $res['hash'] . '.png'); } }
$file = ''; $flvfile = ''; $dllink = ''; } elseif ($res['source'] == 'external') { $embedcode = ''; $flvfile = $res['flvfile']; if ($res['file']) { $file = $res['file']; } else { $dllink = ''; } } else { $embedcode = ''; $flvfile = HTTPDIR . getpath('uploads') . $res['flvfile']; if ($res['file']) { $file = HTTP_HOST . HTTPDIR . getpath('uploads') . $res['file']; } else { $dllink = ''; } } $tabledata[$i]['ID'] = $res['id']; $tabledata[$i]['SECID'] = $res['secid']; $tabledata[$i]['USERID'] = $res['userid']; $tabledata[$i]['USERNAME'] = replace($uploader); $tabledata[$i]['EMAIL'] = replace($uploader_email); $tabledata[$i]['EMAIL_ENCRYPTED'] = replace(cryptMail($uploader_email)); $tabledata[$i]['TITLE'] = $res['title']; $tabledata[$i]['TEXT'] = $text; $tabledata[$i]['LINK'] = $link; $tabledata[$i]['PICTURE'] = $picture; $tabledata[$i]['PICTURE_POPUP'] = $picture_popup;
| ============================ | | (c) Copyright 2005-2009, Christian Scheb | | http://www.stylemotion.de | | | |---------------------------------------------------------------| | THIS SOFTWARE IS NOT FREE! MAKE SURE YOU OWN A VALID LICENSE! | | DO NOT REMOVE ANY COPYRIGHTS WITHOUT PERMISSION! | | SOFTWARE BELONGS TO ITS AUTHORS! | \***************************************************************/ define('APXRUN', true); //////////////////////////////////////////////////////////////////////////////////////////////////////// require 'includes/_start.php'; /////////////////////////////////////////////////////// SYSTEMSTART /// //////////////////////////////////////////////////////////////////////////////////////////////////////// $apx->tmpl->loaddesign('blank'); list($module, $func) = explode('.', $_REQUEST['action'], 2); if (file_exists(BASEDIR . getpath('module', array('MODULE' => $module)) . 'admin_ajax.php')) { include_once BASEDIR . getpath('module', array('MODULE' => $module)) . 'admin_ajax.php'; $call = $func; if (function_exists($call)) { $call(); } else { echo 'function does not exist!'; } } else { echo 'ajax-file does not exist!'; } //////////////////////////////////////////////////////////////////////////////////////////////////////// require 'includes/_end.php'; ////////////////////////////////////////////////////// SCRIPT BEENDEN /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
function copy_with_thumbnail($oldImage, $newImage) { $oldPoppic = str_replace('-thumb.', '.', $oldImage); $newPoppic = str_replace('-thumb.', '.', $newImage); if ($oldImage && file_exists(BASEDIR . getpath('uploads') . $oldImage)) { copy(BASEDIR . getpath('uploads') . $oldImage, BASEDIR . getpath('uploads') . $newImage); if ($oldPoppic && file_exists(BASEDIR . getpath('uploads') . $oldPoppic)) { copy(BASEDIR . getpath('uploads') . $oldPoppic, BASEDIR . getpath('uploads') . $newPoppic); } return true; } return false; }
function clear_cache() { global $db; $data = $db->fetch("SELECT id,hash FROM " . PRE . "_captcha WHERE time<='" . (time() - 3600) . "'"); if (count($data)) { $idlist = array(); foreach ($data as $res) { @unlink(BASEDIR . getpath('uploads') . 'temp/captcha_' . $res['hash'] . '.png'); if (!file_exists(BASEDIR . getpath('uploads') . 'temp/captcha_' . $res['hash'] . '.png')) { $idlist[] = $res['id']; } } $db->query("DELETE FROM " . PRE . "_captcha WHERE id IN (" . implode(',', $idlist) . ")"); } }
sendmail($_POST['email'], 'REG', $input); message($apx->lang->get('MSG_OK'), mklink('user.php', 'user.html')); } } } elseif (!$set['user']['acceptrules'] || $_POST['accept']) { //Sprachen $langlist = '<option value="">' . $apx->lang->get('USEDEFAULT') . '</option>'; foreach ($apx->languages as $id => $name) { $langlist .= '<option value="' . $id . '"' . iif($user->info['pub_lang'] == $id, ' selected="selected"') . '>' . replace($name) . '</option>'; ++$i; $langdata[$i] = array('ID' => $id, 'TITLE' => $name); } //Themes $handle = opendir(BASEDIR . getpath('tmpldir')); while ($file = readdir($handle)) { if ($file == '.' || $file == '..' || !is_dir(BASEDIR . getpath('tmpldir') . $file)) { continue; } $themes[] = $file; } closedir($handle); sort($themes); $themelist = '<option value="">' . $apx->lang->get('USEDEFAULT') . '</option>'; foreach ($themes as $themeid) { $themelist .= '<option value="' . $themeid . '"' . iif($themeid == $user->info['pub_theme'], ' selected="selected"') . '>' . $themeid . '</option>'; ++$i; $themedata[$i] = array('ID' => $themeid, 'TITLE' => $themeid); } //Custom-Felder for ($i = 1; $i <= 10; $i++) { $apx->tmpl->assign('CUSTOM' . $i . '_NAME', $set['user']['cusfield_names'][$i - 1]);
function clean() { global $set, $db, $apx; $_REQUEST['id'] = (int) $_REQUEST['id']; if (!$_REQUEST['id']) { die('missing ID!'); } $_POST['moveto'] = (int) $_POST['moveto']; $finfo = $this->cat->getNode($_REQUEST['id'], explode(',', 'threads,posts,lastposter,lastposter_userid,lastposttime')); if ($_POST['send'] == 1 && $_POST['moveto'] >= 0) { if (!checkToken()) { printInvalidToken(); } else { //Nur was machen, wenn das Zielforum ein anderes ist if (intval($_POST['moveto']) && $_POST['moveto'] != $_REQUEST['id']) { //Lastpost überschreiben oder nicht? $setvalues = "threads=threads+" . $finfo['threads'] . ",posts=posts+" . $finfo['posts'] . ","; $setvalues .= "lastposter=IF(lastposttime<'" . $finfo['lastposttime'] . "','" . $finfo['lastposter'] . "',lastposter),lastposter_userid=IF(lastposttime<'" . $finfo['lastposttime'] . "','" . $finfo['lastposter_userid'] . "',lastposter_userid),lastposttime=IF(lastposttime<'" . $finfo['lastposttime'] . "','" . $finfo['lastposttime'] . "',lastposttime)"; //Postings und Threads aktualisieren $db->query("UPDATE " . PRE . "_forums SET " . $setvalues . " WHERE forumid='" . $_POST['moveto'] . "' LIMIT 1"); $db->query("UPDATE " . PRE . "_forums SET threads=0,posts=0,lastposter='',lastposter_userid='',lastposttime=0 WHERE forumid='" . $_REQUEST['id'] . "' LIMIT 1"); $db->query("UPDATE " . PRE . "_forum_threads SET forumid='" . $_POST['moveto'] . "' WHERE forumid='" . $_REQUEST['id'] . "'"); logit('FORUM_CLEAN', 'ID #' . $_REQUEST['id']); //Forum löschen if ($_POST['delforum'] && !$finfo['children']) { $this->cat->deleteNode($_REQUEST['id']); logit('FORUM_DEL', "ID #" . $_REQUEST['id']); } } elseif (!intval($_POST['moveto'])) { //Themen und unwiderruflich Beiträge löschen $threaddata = $db->fetch("SELECT threadid FROM " . PRE . "_forum_threads WHERE forumid='" . $_REQUEST['id'] . "'"); $threadIds = get_ids($threaddata, 'threadid'); if ($threadIds) { //Anhänge löschen $data = $db->fetch("\n\t\t\t\t\t\tSELECT a.id, a.file\n\t\t\t\t\t\tFROM " . PRE . "_forum_attachments AS a\n\t\t\t\t\t\tLEFT JOIN " . PRE . "_forum_posts AS p USING(postid)\n\t\t\t\t\t\tWHERE p.threadid IN (" . implode(',', $threadIds) . ")\n\t\t\t\t\t"); $attIds = get_ids($data, 'id'); if (count($data)) { foreach ($data as $res) { if (file_exists(BASEDIR . getpath('uploads') . $res['file'])) { @unlink(BASEDIR . getpath('uploads') . $res['file']); } } $db->query("DELETE FROM " . PRE . "_forum_attachments WHERE id IN (" . implode(',', $attIds) . ")"); } $db->query("DELETE FROM " . PRE . "_forum_threads WHERE threadid IN (" . implode(',', $threadIds) . ")"); $db->query("DELETE FROM " . PRE . "_forum_posts WHERE threadid IN (" . implode(',', $threadIds) . ")"); $db->query("DELETE FROM " . PRE . "_forum_index WHERE threadid IN (" . implode(',', $threadIds) . ")"); } //Forum aktualisieren $db->query("UPDATE " . PRE . "_forums SET threads=0,posts=0,lastposter='',lastposter_userid='',lastposttime=0 WHERE forumid='" . $_REQUEST['id'] . "' LIMIT 1"); //Forum löschen if ($_POST['delforum']) { $this->cat->deleteNode($_REQUEST['id']); logit('FORUM_DEL', "ID #" . $_REQUEST['id']); } } logit('FORUM_CLEAN', "ID #" . $_REQUEST['id']); printJSRedirect(get_index('forum.show')); } } else { //Foren auflisten $data = $this->cat->getTree(array('title', 'iscat', 'link')); if (count($data)) { foreach ($data as $res) { if ($res['level'] > 1) { $space = str_repeat(' ', $res['level'] - 1); } else { $space = ''; } if ($res['iscat']) { $style = ' style="background:#EAEAEA;color:#2B2B2B;" disabled="disabled"'; } else { $style = ''; } $forumlist .= '<option value="' . iif(!$res['iscat'] && !$res['link'], $res['forumid'], '-1') . '"' . $style . '' . iif($_POST['moveto'] == $res['forumid'], ' selected="selected"') . '>' . $space . replace($res['title']) . '</option>'; } } list($title) = $db->first("SELECT title FROM " . PRE . "_forums WHERE forumid='" . $_REQUEST['id'] . "' LIMIT 1"); $apx->tmpl->assign('ID', $_REQUEST['id']); $apx->tmpl->assign('TITLE', compatible_hsc($title)); $apx->tmpl->assign('DELFORUM', (int) $_POST['delforum']); $apx->tmpl->assign('DELABLE', $finfo['children'] == '|'); $apx->tmpl->assign('FORUMLIST', $forumlist); tmessageOverlay('clean'); } }
/* Postingzahlen der Benutzer nicht verringern => Postings wurden vielleicht gar nicht gezählt $data=$db->fetch("SELECT count(postid) AS posts,userid FROM ".PRE."_forum_posts WHERE ( threadid='".$threadinfo['threadid']."' AND userid!=0 AND del=0 )"); if ( count($data) ) { foreach ( $data AS $res ) { $db->query("UPDATE ".PRE."_user SET forum_posts=forum_posts-".$res['posts']." WHERE userid='".$res['userid']."' LIMIT 1"); } }*/ //Thema und Beiträge löschen if ($_POST['realdel'] && $user->info['userid'] && ($user->is_admin() || in_array($user->info['userid'], $foruminfo['moderator']))) { //Anhänge löschen $data = $db->fetch("\n\t\t\t\tSELECT a.id, a.file\n\t\t\t\tFROM " . PRE . "_forum_attachments AS a\n\t\t\t\tLEFT JOIN " . PRE . "_forum_posts AS p USING(postid)\n\t\t\t\tWHERE p.threadid='" . $threadinfo['threadid'] . "'\n\t\t\t"); $attIds = get_ids($data, 'id'); if (count($data)) { foreach ($data as $res) { if (file_exists(BASEDIR . getpath('uploads') . $res['file'])) { @unlink(BASEDIR . getpath('uploads') . $res['file']); } } $db->query("DELETE FROM " . PRE . "_forum_attachments WHERE id IN (" . implode(',', $attIds) . ")"); } //SQL löschen $db->query("DELETE FROM " . PRE . "_forum_threads WHERE threadid='" . $threadinfo['threadid'] . "' LIMIT 1"); $db->query("DELETE FROM " . PRE . "_forum_threads WHERE moved='" . $threadinfo['threadid'] . "' LIMIT 1"); $db->query("DELETE FROM " . PRE . "_forum_posts WHERE threadid='" . $threadinfo['threadid'] . "'"); } else { $db->query("UPDATE " . PRE . "_forum_threads SET del=1 WHERE threadid='" . $threadinfo['threadid'] . "' LIMIT 1"); $db->query("DELETE FROM " . PRE . "_forum_threads WHERE moved='" . $threadinfo['threadid'] . "' LIMIT 1"); //Beiträge werden nicht explizit als gelöscht markiert //So ist Wiederherstellung im Ursprungszustand möglich! //$db->query("UPDATE ".PRE."_forum_posts SET del=1 WHERE threadid='".$threadinfo['threadid']."'"); }
$template = $_REQUEST['show']; $template = str_replace('/', '', $template); $template = str_replace('\\', '', $template); $template = str_replace('.', '/', $template); if (file_exists(BASEDIR . getpath('tmpl_modules_public', array('MODULE' => 'content', 'THEME' => $apx->tmpl->theme)) . $template . '.html')) { $apx->tmpl->parse($template); } else { filenotfound(); } } elseif ($_REQUEST['inc']) { $template = $_REQUEST['inc']; $template = str_replace('/', '', $template); $template = str_replace('\\', '', $template); $filepath = str_replace('.', '/', $template) . '.php'; if (file_exists(BASEDIR . getpath('content') . $filepath)) { include BASEDIR . getpath('content') . $filepath; } else { filenotfound(); } } elseif ($apx->is_module('comments') && $_REQUEST['id'] && $_REQUEST['comments']) { $res = $db->first("SELECT title FROM " . PRE . "_content AS a WHERE ( id='" . $_REQUEST['id'] . "' AND active='1' " . section_filter() . " ) LIMIT 1"); //Titel $tt = explode('->', $res['title']); $number = count($tt); foreach ($tt as $one) { ++$hi; if ($number == $hi) { headline(trim($one), str_replace('&', '&', $_SERVER['REQUEST_URI'])); } else { headline(trim($one)); }
$statarr = stat($path); echo $statarr["size"]; } else { checkerror(6); } } else { if ($_REQUEST['action'] == "exists") { $path = getpath(); if (file_exists($path)) { //yes } else { checkerror(6); } } else { if ($_REQUEST['action'] == "md5") { $path = getpath(); if (file_exists($path)) { echo substr(shell_exec('md5sum ' . $path), 0, 32); } else { checkerror(6); } } else { http_response_code(500); echo 'unknown method'; } } } } } } }
if (is_array($data['version'])) { $data['version'] = $data['version'][0]; } $data['version'] = trim($data['version']); $data['no_cert'] = getpath("//@noCertificado"); if (is_array($data['no_cert'])) { $data['no_cert'] = $data['no_cert'][0]; } $data['no_cert'] = trim($data['no_cert']); $data['cert'] = getpath("//@certificado"); $data['sell'] = getpath("//@sello"); } $data['sellocfd'] = getpath("//@selloCFD"); $data['sellosat'] = getpath("//@selloSAT"); $data['no_cert_sat'] = getpath("//@noCertificadoSAT"); $data['uuid'] = getpath("//@UUID"); // echo "<pre>"; // print_r($data); // echo "</pre>"; // Valores guardados en un arreglo para ser usado por las funciones ///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// // Conexion a la base de datos para leer la lista de CSD // autorizados por el SAT // // http://www.lacorona.com.mx/fortiz/sat/valida.php para ver estas tablas // // myconn es una conexion a MI BASE DE DATOS // yo uso adodb http://phplens.com/lens/adodb/docs-adodb.htm // pero ya los parametros de conexion a mi base de datos no te digo ;) require_once "myconn/myconn.inc.php";
function videos_filesize($info) { if ($info['source'] == 'external') { return $info['filesize']; } elseif ($info['source'] == 'apexx' && file_exists(BASEDIR . getpath('uploads') . $info['file'])) { return filesize(BASEDIR . getpath('uploads') . $info['file']); } return 0; }
function deletefile($filepath) { if (!unlink(BASEDIR . getpath('uploads') . $filepath)) { echo 'can not delete file!'; } }
} return $path; } //Собственно старт $uploadDir = 'img/'; //папка для хранения файлов $miniuploadDir = 'img/mini/'; //папка для хранения файлов $dir = ''; //базовый путь к скрипту $mwidth = 500; $allowedExt = array('jpg', 'jpeg', 'png', 'gif'); $maxFileSize = 10 * 1024 * 1024; //10 MB $uploadDir = getpath($uploadDir); $miniuploadDir = getpath($miniuploadDir); //если получен файл if (isset($_FILES)) { //проверяем размер и тип файла $ext = end(explode('.', strtolower($_FILES['Filedata']['name']))); if (!in_array($ext, $allowedExt)) { return; } if ($maxFileSize < $_FILES['Filedata']['size']) { return; } if (is_uploaded_file($_FILES['Filedata']['tmp_name'])) { //Магия с созданием уникального имени. Начало $fileName = $uploadDir . $_FILES['Filedata']['name']; $nameParts = explode('.', $_FILES['Filedata']['name']); $nameParts[count($nameParts) - 2] = substr(md5(time()), 7);
_getCFDI('Receptor'); _getCFDI('Domicilio'); _getConceptos(); _getCFDI('Impuestos'); _getCFDI('Traslado'); _getTFD('TimbreFiscalDigital'); $data['version'] = getpath("//@Version"); if (is_array($data['version'])) { $data['version'] = $data['version'][0]; } $data['version'] = trim($data['version']); if (is_array($data['version'])) { $data['version'] = $data['version'][0]; } $data['sellocfd'] = getpath("//@selloCFD"); $data['sellosat'] = getpath("//@selloSAT"); $data['no_cert_sat'] = getpath("//@noCertificadoSAT"); } $i = 0; foreach ($data['Concepto'] as $key => $val) { $d = 0; foreach ($val as $k => $v) { $header[$d] = $k; $d++; $body[$i][$k] = $v; } $i++; } $pdf = new PDF('P', 'mm', 'Letter'); $pdf->FancyTable($header, $data['Concepto']); $pdf->Output();
function myprofile() { global $set, $apx, $db; //Weiterleisten auf Loginseite, wenn nicht angemeldet if (!$apx->user->info['userid']) { header('Location: index.php'); } if ($_POST['send'] == 1) { if (!checkToken()) { infoInvalidToken(); } elseif (!$_POST['username'] || ($_POST['pwd1'] || $_POST['pwd2']) && (!$_POST['pwd1'] || !$_POST['pwd2']) || !$_POST['email']) { infoNotComplete(); } elseif ($_POST['pwd1'] != $_POST['pwd2']) { info($apx->lang->get('INFO_PWNOMATCH')); } elseif (strlen($_POST['signature']) > $set['user']['sigmaxlen']) { info($apx->lang->get('INFO_SIGTOOLONG')); } elseif (!checkmail($_POST['email'])) { info($apx->lang->get('INFO_NOMAIL')); } else { if (substr($_POST['homepage'], 0, 4) == 'www.') { $_POST['homepage'] = 'http://' . $_POST['homepage']; } if ($_POST['pwd1']) { $_POST['salt'] = random_string(); $_POST['password'] = md5(md5($_POST['pwd1']) . $_POST['salt']); } if ($_POST['bd_day'] && $_POST['bd_mon'] && $_POST['bd_year']) { $_POST['birthday'] = sprintf('%02d-%02d-%04d', $_POST['bd_day'], $_POST['bd_mon'], $_POST['bd_year']); } elseif ($_POST['bd_day'] && $_POST['bd_day']) { $_POST['birthday'] = sprintf('%02d-%02d', $_POST['bd_day'], $_POST['bd_mon']); } else { $_POST['birthday'] = ''; } //Location bestimmen $_POST['locid'] = user_get_location($_POST['plz'], $_POST['city'], $_POST['country']); $db->dupdate(PRE . '_user', iif($_POST['pwd1'], 'password,salt,') . 'username,email,homepage,icq,aim,yim,msn,skype,realname,gender,birthday,city,plz,country,locid,interests,work,custom1,custom2,custom3,custom4,custom5,custom6,custom7,custom8,custom9,custom10,signature,pub_lang,pub_invisible,pub_hidemail,pub_poppm,pub_usegb,pub_gbmail,pub_profileforfriends,pub_showbuddies,pub_theme,admin_lang,admin_editor' . iif($apx->is_module('forum'), ',forum_autosubscribe'), "WHERE userid='" . $apx->user->info['userid'] . "'"); logit('USER_MYPROFILE'); if ($_POST['pwd1']) { $apx->session->destroy(); setcookie($set['main']['cookie_pre'] . '_admin_userid', 0, time() - 99999, '/'); setcookie($set['main']['cookie_pre'] . '_admin_password', 0, time() - 99999, '/'); unset($_COOKIE[$set['main']['cookie_pre'] . '_admin_userid'], $_COOKIE[$set['main']['cookie_pre'] . '_admin_password']); } printJSRedirect('action.php?action=user.myprofile'); } } else { $ex = array('userid', 'password', 'birthday', 'reg_time', 'reg_email', 'lastonline', 'lastactive'); foreach ($apx->user->info as $key => $val) { if (in_array($key, $ex)) { continue; } $_POST[$key] = $val; } list($_POST['bd_day'], $_POST['bd_mon'], $_POST['bd_year']) = explode('-', $apx->user->info['birthday']); //Sprache foreach ($apx->languages as $id => $name) { $lang_admin .= '<option value="' . $id . '"' . iif($_POST['admin_lang'] == $id, ' selected="selected"') . '>' . $name . '</option>'; $lang_pub .= '<option value="' . $id . '"' . iif($_POST['pub_lang'] == $id, ' selected="selected"') . '>' . $name . '</option>'; } //Themes $handle = opendir(BASEDIR . getpath('tmpldir')); while ($file = readdir($handle)) { if ($file == '.' || $file == '..' || !is_dir(BASEDIR . getpath('tmpldir') . $file)) { continue; } $themes[] = $file; } closedir($handle); sort($themes); foreach ($themes as $themeid) { $themelist .= '<option value="' . $themeid . '"' . iif($themeid == $_POST['pub_theme'], ' selected="selected"') . '>' . $themeid . '</option>'; } //Custom-Felder for ($i = 1; $i <= 10; $i++) { $fieldname = $set['user']['cusfield_names'][$i - 1]; $apx->tmpl->assign('CUSFIELD' . $i . '_NAME', replace($fieldname)); $apx->tmpl->assign('CUSTOM' . $i, compatible_hsc($_POST['custom' . $i])); } $apx->tmpl->assign('USERNAME_LOGIN', replace($_POST['username_login'])); $apx->tmpl->assign('USERNAME', compatible_hsc($_POST['username'])); $apx->tmpl->assign('EMAIL', compatible_hsc($_POST['email'])); $apx->tmpl->assign('HOMEPAGE', compatible_hsc($_POST['homepage'])); $apx->tmpl->assign('ICQ', (int) $_POST['icq']); $apx->tmpl->assign('AIM', compatible_hsc($_POST['aim'])); $apx->tmpl->assign('YIM', compatible_hsc($_POST['yim'])); $apx->tmpl->assign('MSN', compatible_hsc($_POST['msn'])); $apx->tmpl->assign('SKYPE', compatible_hsc($_POST['skype'])); $apx->tmpl->assign('REALNAME', compatible_hsc($_POST['realname'])); $apx->tmpl->assign('CITY', compatible_hsc($_POST['city'])); $apx->tmpl->assign('COUNTRY', compatible_hsc($_POST['country'])); $apx->tmpl->assign('PLZ', compatible_hsc($_POST['plz'])); $apx->tmpl->assign('INTERESTS', compatible_hsc($_POST['interests'])); $apx->tmpl->assign('WORK', compatible_hsc($_POST['work'])); $apx->tmpl->assign('GENDER', (int) $_POST['gender']); $apx->tmpl->assign('BD_DAY', (int) $_POST['bd_day']); $apx->tmpl->assign('BD_MON', (int) $_POST['bd_mon']); $apx->tmpl->assign('BD_YEAR', (int) $_POST['bd_year']); $apx->tmpl->assign('SIGNATURE', compatible_hsc($_POST['signature'])); $apx->tmpl->assign('MAXLEN', $set['user']['sigmaxlen']); $apx->tmpl->assign('PUB_INVISIBLE', (int) $_POST['pub_invisible']); $apx->tmpl->assign('PUB_HIDEMAIL', (int) $_POST['pub_hidemail']); $apx->tmpl->assign('PUB_POPPM', (int) $_POST['pub_poppm']); $apx->tmpl->assign('PUB_SHOWBUDDIES', (int) $_POST['pub_showbuddies']); $apx->tmpl->assign('PUB_USEGB', (int) $_POST['pub_usegb']); $apx->tmpl->assign('PUB_GBMAIL', (int) $_POST['pub_gbmail']); $apx->tmpl->assign('PUB_THEME', $themelist); $apx->tmpl->assign('PUB_LANG', $lang_pub); $apx->tmpl->assign('PUB_PROFILEFORFRIENDS', (int) $_POST['pub_profileforfriends']); $apx->tmpl->assign('FORUM_AUTOSUBSCRIBE', (int) $_POST['forum_autosubscribe']); $apx->tmpl->assign('ADMIN_LANG', $lang_admin); $apx->tmpl->assign('ADMIN_EDITOR', (int) $_POST['admin_editor']); $apx->tmpl->parse('myprofile'); } }
function super_file($access_token, $path, $localfile, $ondup = 'newcopy', $sbyte = 1073741824, $temp_dir = '/tmp/') { //调用split命令进行切割 //split -b200 --verbose rubygems-1.8.25.zip rg/rg1 if (filesize($localfile) <= $sbyte) { echon('The file isn\'t big enough to split up. Proceed to upload normally.'); upload_file($access_token, $path, $localfile, $ondup); //直接上传 } $tempfdir = rtrim($temp_dir, '/') . '/' . uniqid('bpcs_to_upload_'); if (!mkdir($tempfdir, 0700, true)) { echon('Cannot create temp dir:' . $tempfdir); die(9009); } $splitcmd = "split -b{$sbyte} {$localfile} {$tempfdir}/bpcs_toupload_"; $splitresult = cmd($splitcmd); if (trim($splitresult)) { echon('Split exited with message:' . $splitresult); } //遍历临时文件目录 $tempfiles = glob($tempfdir . '/bpcs_toupload_*'); if (count($tempfiles) < 1) { //没有生成文件 echon('There are no files to be upload.'); die(9010); } elseif (count($tempfiles) == 1) { //只有一个文件 unlink($tempfiles[0]); //删除它 echon('The file isn\'t big enough to split up. Proceed to upload normally.'); upload_file($access_token, $path, $localfile, $ondup); //直接上传 return; } //开始上传进程 $block_list = array(); $count = 0; foreach ($tempfiles as $tempfile) { //上传临时文件,上传API与上传普通文件无异,只是多一个参数type=tmpfile,取消了其它几个参数。此处将“&type=tmpfile”作为ondup传递,将参数带在请求尾部。 echon('Uploading file in pieces, ' . ($count + 1) . ' out of ' . count($tempfiles) . ' parts... '); $count++; $upload_res = upload_file($access_token, '', $tempfile, $ondup . '&type=tmpfile'); $block_list[] = $upload_res['md5']; //删除临时文件 unlink($tempfile); } //删除临时文件夹 rmdir($tempfdir); //准备提交API $block_list = json_encode($block_list); $param = '{"block_list":' . $block_list . '}'; $param = 'param=' . urlencode($param); $path = getpath($path); $url = "https://pcs.baidu.com/rest/2.0/file?method=createsuperfile&path={$path}&access_token={$access_token}"; $res = do_api($url, $param); }
} $mm->deletefile('temp/' . $tempname); $db->query("UPDATE " . PRE . "_user SET avatar='" . addslashes($newfile) . "',avatar_title='" . addslashes($_POST['avatar_title']) . "' WHERE userid='" . $user->info['userid'] . "' LIMIT 1"); if ($user->info['avatar']) { $mm->deletefile('user/' . $user->info['avatar']); } message($apx->lang->get('MSG_OK'), mklink('user.php?action=avatar', 'user,avatar.html')); } } else { if (!in_array($ext, $extensions)) { message($apx->lang->get('MSG_NOTALLOWED'), 'javascript:history.back()'); } elseif ($_FILES['avatar']['size'] > $set['user']['avatar_maxsize']) { message($apx->lang->get('MSG_MAXSIZE'), 'javascript:history.back()'); } else { $mm->uploadfile($_FILES['avatar'], 'user', $newfile); $info = getimagesize(BASEDIR . getpath('uploads') . 'user/' . $newfile); if ($info[0] > $set['user']['avatar_maxdim'] || $info[1] > $set['user']['avatar_maxdim'] || $info[0] == 0 || $info[1] == 0) { $mm->deletefile('user/' . $newfile); message($apx->lang->get('MSG_MAXDIM'), 'javascript:history.back()'); require 'lib/_end.php'; } $db->query("UPDATE " . PRE . "_user SET avatar='" . addslashes($newfile) . "',avatar_title='" . addslashes($_POST['avatar_title']) . "' WHERE userid='" . $user->info['userid'] . "' LIMIT 1"); if ($user->info['avatar']) { $mm->deletefile('user/' . $user->info['avatar']); } message($apx->lang->get('MSG_OK'), mklink('user.php?action=avatar', 'user,avatar.html')); } } } elseif ($_POST['delav']) { require BASEDIR . 'lib/class.mediamanager.php'; $mm = new mediamanager();
function clear_cache($filepath = false) { //Bestimmte Datei if ($filepath !== false && is_string($filepath)) { $handler = opendir(BASEDIR . getpath('cache')); while ($file = readdir($handler)) { if ($file == '.' || $file == '..' || $file == 'index.html') { continue; } if (!preg_match('#^' . $this->encode_path($filepath) . '[0-9]+\\.php$#', $file)) { continue; } unlink(BASEDIR . getpath('cache') . $file); } closedir($handler); return; } //Gesamter Cache $handler = opendir(BASEDIR . getpath('cache')); while ($file = readdir($handler)) { if ($file == '.' || $file == '..' || $file == 'index.html') { continue; } unlink(BASEDIR . getpath('cache') . $file); } closedir($handler); }