Beispiel #1
0
<?php

$apx->lang->drop('avatar');
headline($apx->lang->get('HEADLINE_AVATAR'), str_replace('&', '&amp;', $_SERVER['REQUEST_URI']));
titlebar($apx->lang->get('HEADLINE_AVATAR'));
$extensions = array('GIF', 'JPG', 'JPE', 'JPEG', 'PNG');
if ($_POST['send']) {
    //Neuen Avatar hochladen
    if (is_uploaded_file($_FILES['avatar']['tmp_name'])) {
        require BASEDIR . 'lib/class.mediamanager.php';
        $mm = new mediamanager();
        $ext = $mm->getext($_FILES['avatar']['name']);
        $newfile = 'avatar_' . $user->info['userid'] . '_' . time() . '.' . strtolower($ext);
        //AVATARE AUTOMATISCH VERKLEINERN
        if ($set['user']['avatar_resize']) {
            require BASEDIR . 'lib/class.image.php';
            $img = new image();
            if (!in_array($ext, $extensions)) {
                message($apx->lang->get('MSG_NOTALLOWED'), 'javascript:history.back()');
            } else {
                $tempname = 'avatar_' . md5(microtime()) . '.tmp';
                $mm->uploadfile($_FILES['avatar'], 'temp', $tempname);
                $info = getimagesize(BASEDIR . getpath('uploads') . 'temp/' . $tempname);
                //Kein Bild => löschen und Ende
                if ($info[0] == 0 || $info[1] == 0) {
                    $mm->deletefile('temp/' . $tempname);
                    message($apx->lang->get('MSG_MAXDIM'), 'javascript:history.back()');
                    require 'lib/_end.php';
                }
                //Bild zu groß => verkleinern
                if ($info[0] > $set['user']['avatar_maxdim'] || $info[1] > $set['user']['avatar_maxdim']) {
Beispiel #2
0
 }
 $mysql = "\n\t\t\t\tALTER TABLE `apx_forums` ADD `stylesheet` TINYTEXT NOT NULL AFTER `inherit` ;\n\t\t\t\tALTER TABLE `apx_forum_threads` ADD `prefix` INT( 11 ) UNSIGNED NOT NULL AFTER `forumid` ;\n\t\t\t\tALTER TABLE `apx_forum_attachments` ADD `thumbnail` TINYTEXT NOT NULL AFTER `file` ; \n\t\t\t\tALTER TABLE `apx_forums` ADD `lastpost` INT( 11 ) UNSIGNED NOT NULL AFTER `children` ;\n\t\t\t\tALTER TABLE `apx_forums` ADD `lastthread` INT( 11 ) UNSIGNED NOT NULL AFTER `lastposttime` , ADD `lastthread_title` TINYTEXT NOT NULL AFTER `lastthread`, ADD `lastthread_icon` INT( 11 ) NOT NULL DEFAULT '-1' AFTER `lastthread_title` , ADD `lastthread_prefix` INT( 11 ) UNSIGNED NOT NULL AFTER `lastthread_icon` ;\n\t\t\t\t\n\t\t\t\tINSERT INTO `apx_cron` VALUES ('clean', 'forum', '86400', '1268002800', '');\n\t\t\t\t\n\t\t\t\tCREATE TABLE `apx_forum_activity` (\n\t\t\t\t  `userid` int(11) unsigned NOT NULL,\n\t\t\t\t  `ip` int(11) unsigned NOT NULL,\n\t\t\t\t  `type` enum('forum','thread') NOT NULL,\n\t\t\t\t  `id` int(11) unsigned NOT NULL,\n\t\t\t\t  `time` int(11) unsigned NOT NULL,\n\t\t\t\t  `invisible` tinyint(1) unsigned NOT NULL,\n\t\t\t\t  PRIMARY KEY  (`userid`,`ip`,`type`,`id`)\n\t\t\t\t) ENGINE=MyISAM;\n\t\t\t\t\n\t\t\t\tCREATE TABLE `apx_forum_anndisplay` (\n\t\t\t\t  `id` int(11) unsigned NOT NULL,\n\t\t\t\t  `forumid` int(11) unsigned NOT NULL,\n\t\t\t\t  PRIMARY KEY  (`id`,`forumid`)\n\t\t\t\t) ENGINE=MyISAM;\n\t\t\t\t\n\t\t\t\tCREATE TABLE `apx_forum_announcements` (\n\t\t\t\t  `id` int(11) unsigned NOT NULL auto_increment,\n\t\t\t\t  `userid` int(11) unsigned NOT NULL,\n\t\t\t\t  `title` varchar(255) NOT NULL default '',\n\t\t\t\t  `text` text NOT NULL,\n\t\t\t\t  `addtime` int(11) unsigned NOT NULL,\n\t\t\t\t  `starttime` int(11) unsigned NOT NULL,\n\t\t\t\t  `endtime` int(11) unsigned NOT NULL,\n\t\t\t\t  `views` int(11) unsigned NOT NULL default '0',\n\t\t\t\t  PRIMARY KEY  (`id`),\n\t\t\t\t  KEY `starttime` (`starttime`,`endtime`)\n\t\t\t\t) ENGINE=MyISAM ;\n\t\t\t\t\n\t\t\t\tCREATE TABLE `apx_forum_prefixes` (\n\t\t\t\t  `prefixid` int(11) unsigned NOT NULL auto_increment,\n\t\t\t\t  `forumid` int(11) unsigned NOT NULL,\n\t\t\t\t  `title` tinytext NOT NULL,\n\t\t\t\t  `code` tinytext NOT NULL,\n\t\t\t\t  PRIMARY KEY  (`prefixid`)\n\t\t\t\t) ENGINE=MyISAM ;\n\t\t\t";
 $queries = split_sql($mysql);
 foreach ($queries as $query) {
     $db->query($query);
 }
 //Anhänge aktualisieren
 $attachments = '';
 $data = $db->fetch("\n\t\t\t\tSELECT id, file FROM\n\t\t\t\t" . PRE . "_forum_attachments\n\t\t\t");
 if (count($data)) {
     require BASEDIR . 'lib/class.mediamanager.php';
     require BASEDIR . 'lib/class.image.php';
     $mm = new mediamanager();
     $img = new image();
     foreach ($data as $res) {
         $ext = strtolower($mm->getext($res['file']));
         if (in_array($ext, array('gif', 'jpg', 'jpe', 'jpeg', 'png'))) {
             $fileid = substr($res['file'], 0, -1 * (strlen($ext) - 1));
             $thumbnailPath = $fileid . '_thumb.' . $ext;
             list($picture, $picturetype) = $img->getimage($res['file']);
             //////// THUMBNAIL
             $thumbnail = $img->resize($picture, 120, 90, true);
             $img->saveimage($thumbnail, $picturetype, $thumbnailPath);
             //Cleanup
             imagedestroy($picture);
             imagedestroy($thumbnail);
             unset($picture, $thumbnail);
             //Update SQL
             $db->query("UPDATE " . PRE . "_forum_attachments SET thumbnail='" . addslashes($thumbnailPath) . "' WHERE id='" . $res['id'] . "' LIMIT 1");
         }
     }
Beispiel #3
0
 $typeinfo = array();
 $data = $db->fetch("SELECT * FROM " . PRE . "_forum_filetypes ORDER BY ext ASC");
 if (count($data)) {
     foreach ($data as $res) {
         $filetypes[] = $res['ext'];
         $typeinfo[$res['ext']] = array($res['size'] * 1024, $res['icon']);
     }
 }
 //Anhänge auslesen
 $attachments = '';
 $data = $db->fetch("SELECT * FROM " . PRE . "_forum_attachments WHERE ( postid='" . $postinfo['postid'] . "' AND hash='" . addslashes($postinfo['hash']) . "' ) ORDER BY name ASC");
 if (count($data)) {
     require BASEDIR . 'lib/class.mediamanager.php';
     $mm = new mediamanager();
     foreach ($data as $res) {
         $ext = strtolower($mm->getext($res['name']));
         $attachments .= '<img src="' . $typeinfo[$ext][1] . '" alt="" style="vertical-align:middle;" /> ' . $res['name'] . ' (' . round($res['size'] / 1024) . ' KB)';
     }
 }
 //Präfixe
 $prefixdata = array();
 $prefixInfo = forum_prefixes($foruminfo['forumid']);
 foreach ($prefixInfo as $prefix) {
     $prefixdata[] = array('ID' => $prefix['prefixid'], 'TITLE' => compatible_hsc($prefix['title']), 'SELECTED' => $_POST['prefix'] == $prefix['prefixid']);
 }
 $apx->tmpl->assign('USERID', $postinfo['userid']);
 if ($postinfo['userid']) {
     $apx->tmpl->assign('USERNAME', replace($postinfo['username']));
 } else {
     $apx->tmpl->assign('USERNAME', compatible_hsc($_POST['username']));
 }
Beispiel #4
0
 function edit()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     $info = $db->first("SELECT title,image,link FROM " . PRE . "_affiliates WHERE id='" . intval($_REQUEST['id']) . "' LIMIT 1");
     if ($_POST['send'] == 1) {
         require BASEDIR . 'lib/class.mediamanager.php';
         $mm = new mediamanager();
         $ext = $mm->getext($_FILES['image']['name']);
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['link']) {
             infoNotComplete();
         } elseif ($_FILES['image']['tmp_name'] && !in_array($ext, array('GIF', 'JPG', 'JPE', 'JPEG', 'PNG'))) {
             info($apx->lang->get('INFO_NOIMAGE'));
         } else {
             //Bild aktualisieren
             if ($_FILES['image']['tmp_name']) {
                 list($oldpic) = $db->first("SELECT image FROM " . PRE . "_affiliates WHERE id='" . $_REQUEST['id'] . "'  LIMIT 1");
                 if ($oldpic) {
                     $mm->deletefile($oldpic);
                 }
                 $newfile = 'affiliate-' . intval($_REQUEST['id']) . '.' . strtolower($ext);
                 $mm->uploadfile($_FILES['image'], 'affiliates', $newfile);
                 $_POST['image'] = 'affiliates/' . $newfile;
             } elseif ($_POST['delimage']) {
                 list($oldpic) = $db->first("SELECT image FROM " . PRE . "_affiliates WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
                 $mm->deletefile($oldpic);
                 $_POST['image'] = '';
             }
             $db->dupdate(PRE . '_affiliates', 'title,link' . iif(isset($_POST['image']), ',image'), "WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
             logit('AFFILIATES_EDIT', 'ID #' . $_REQUEST['id']);
             printJSRedirect(get_index('affiliates.show'));
         }
     } else {
         $_POST['title'] = $info['title'];
         $_POST['link'] = $info['link'];
         $imageWidth = '';
         if ($info['image']) {
             $size = @getimagesize(BASEDIR . getpath('uploads') . $info['image']);
             if ($size[0] && $size[0] > 300) {
                 $imageWidth = 300;
             }
         }
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('LINK', compatible_hsc($_POST['link']));
         $apx->tmpl->assign('IMAGE', iif($info['image'], getpath('uploads') . $info['image']));
         $apx->tmpl->assign('IMAGE_WIDTH', $imageWidth);
         $apx->tmpl->assign('DELIMAGE', (int) $_POST['delimage']);
         $apx->tmpl->parse('edit');
     }
 }
Beispiel #5
0
    $typeinfo = array();
    $icondata = $db->fetch("SELECT ext,icon FROM " . PRE . "_forum_filetypes ORDER BY ext ASC");
    if (count($icondata)) {
        foreach ($icondata as $icon) {
            $typeicon[$icon['ext']] = $icon['icon'];
        }
    }
    foreach ($attdata as $att) {
        if ($att['hash'] != $res['hash']) {
            continue;
        }
        //Nur Anhänge mit gültigem Hash-Wert
        ++$ai;
        if ($att['thumbnail']) {
            $imgatttable[$ai]['THUMBNAIL'] = HTTPDIR . getpath('uploads') . $att['thumbnail'];
            $imgatttable[$ai]['ICON'] = $typeicon[strtolower($mm->getext($att['name']))];
            $imgatttable[$ai]['NAME'] = replace($att['name']);
            $imgatttable[$ai]['LINK'] = 'attachments.php?getid=' . $att['id'];
            $imgatttable[$ai]['SIZE'] = forum_getsize($att['size']);
        } else {
            $atttable[$ai]['ICON'] = $typeicon[strtolower($mm->getext($att['name']))];
            $atttable[$ai]['NAME'] = replace($att['name']);
            $atttable[$ai]['LINK'] = 'attachments.php?getid=' . $att['id'];
            $atttable[$ai]['SIZE'] = forum_getsize($att['size']);
        }
    }
}
//Rang
$rankinfo = get_rank($userdat);
$apx->tmpl->assign('ID', $postinfo['postid']);
$apx->tmpl->assign('TITLE', replace($postinfo['title']));
Beispiel #6
0
$postids = get_ids($data, 'postid');
$attinfo = array();
$attimage = array();
if (count($postids)) {
    $attdata = $db->fetch("SELECT id,postid,hash,file,thumbnail,name,size FROM " . PRE . "_forum_attachments WHERE postid IN (" . implode(',', $postids) . ") ORDER BY name ASC");
    if (count($attdata)) {
        $typeinfo = array();
        $icondata = $db->fetch("SELECT ext,icon FROM " . PRE . "_forum_filetypes ORDER BY ext ASC");
        if (count($icondata)) {
            foreach ($icondata as $res) {
                $typeicon[$res['ext']] = $res['icon'];
            }
        }
        foreach ($attdata as $res) {
            if ($res['thumbnail']) {
                $attimage[$res['postid']][] = array_merge($res, array('icon' => $typeicon[strtolower($mm->getext($res['name']))]));
            } else {
                $attinfo[$res['postid']][] = array_merge($res, array('icon' => $typeicon[strtolower($mm->getext($res['name']))]));
            }
        }
    }
}
//Userinfo auslesen
$userids = get_ids($data, 'userid');
$userinfo = array();
if (count($userids)) {
    $userdata = $db->fetch("SELECT a.userid,a.groupid,a.reg_time,a.forum_posts,a.avatar,a.avatar_title,a.signature,a.homepage,a.city,a.icq,a.aim,a.yim,a.msn,a.skype,a.forum_lastactive,a.pub_invisible,a.custom1,a.custom2,a.custom3,a.custom4,a.custom5,a.custom6,a.custom7,a.custom8,a.custom9,a.custom10,b.gtype FROM " . PRE . "_user AS a LEFT JOIN " . PRE . "_user_groups AS b USING(groupid) WHERE a.userid IN (" . implode(',', $userids) . ")");
    if (count($userdata)) {
        foreach ($userdata as $res) {
            $userinfo[$res['userid']] = $res;
        }
Beispiel #7
0
 function edit()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     //Sektions-Liste
     if (!is_array($_POST['secid']) || $_POST['secid'][0] == 'all') {
         $_POST['secid'] = array('all');
     }
     $info = $db->first("SELECT secid,`group`,title,text,image,link,starttime,endtime FROM " . PRE . "_teaser WHERE id='" . intval($_REQUEST['id']) . "' LIMIT 1");
     if ($_POST['send'] == 1) {
         require BASEDIR . 'lib/class.mediamanager.php';
         $mm = new mediamanager();
         $ext = $mm->getext($_FILES['image']['name']);
         if (!checkToken()) {
             infoInvalidToken();
         } elseif (!$_POST['title'] || !$_POST['link']) {
             infoNotComplete();
         } elseif ($_FILES['image']['tmp_name'] && !in_array($ext, array('GIF', 'JPG', 'JPE', 'JPEG', 'PNG'))) {
             info($apx->lang->get('INFO_NOIMAGE'));
         } else {
             //Bild aktualisieren
             if ($_FILES['image']['tmp_name']) {
                 list($oldpic) = $db->first("SELECT image FROM " . PRE . "_teaser WHERE id='" . $_REQUEST['id'] . "'  LIMIT 1");
                 if ($oldpic) {
                     $mm->deletefile($oldpic);
                 }
                 $newfile = 'teaser-' . intval($_REQUEST['id']) . '.' . strtolower($ext);
                 $mm->uploadfile($_FILES['image'], 'teaser', $newfile);
                 $_POST['image'] = 'teaser/' . $newfile;
             } elseif ($_POST['delimage']) {
                 list($oldpic) = $db->first("SELECT image FROM " . PRE . "_teaser WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
                 $mm->deletefile($oldpic);
                 $_POST['image'] = '';
             }
             $_POST['secid'] = serialize_section($_POST['secid']);
             //Veröffentlichung
             $addfields = '';
             if ($apx->user->has_right('teaser.enable') && isset($_POST['t_day_1'])) {
                 $_POST['starttime'] = maketime(1);
                 $_POST['endtime'] = maketime(2);
                 if ($_POST['starttime']) {
                     if (!$_POST['endtime'] || $_POST['endtime'] <= $_POST['starttime']) {
                         $_POST['endtime'] = 3000000000;
                     }
                     $addfields = ',starttime,endtime';
                 }
             }
             $db->dupdate(PRE . '_teaser', 'secid,group,title,text,link' . iif(isset($_POST['image']), ',image') . $addfields, "WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
             logit('TEASER_EDIT', 'ID #' . $_REQUEST['id']);
             printJSRedirect(get_index('teaser.show'));
         }
     } else {
         $_POST['group'] = $info['group'];
         $_POST['title'] = $info['title'];
         $_POST['text'] = $info['text'];
         $_POST['link'] = $info['link'];
         $_POST['starttime'] = $info['starttime'];
         $_POST['endtime'] = $info['endtime'];
         $_POST['secid'] = unserialize_section($info['secid']);
         $imageWidth = '';
         if ($info['image']) {
             $size = @getimagesize(BASEDIR . getpath('uploads') . $info['image']);
             if ($size[0] && $size[0] > 300) {
                 $imageWidth = 300;
             }
         }
         //Bannergruppen auflisten
         $grouplist = '';
         foreach ($set['teaser']['groups'] as $id => $title) {
             $grouplist .= '<option value="' . $id . '"' . iif($id == $_POST['group'], ' selected="selected"') . '>' . replace($title) . '</option>';
         }
         //Veröffentlichung
         if ($_POST['starttime']) {
             maketimepost(1, $_POST['starttime']);
             if ($_POST['endtime'] < 2147483647) {
                 maketimepost(2, $_POST['endtime']);
             }
         }
         //Veröffentlichung
         if ($apx->user->has_right('teaser.enable') && isset($_POST['t_day_1'])) {
             $apx->tmpl->assign('STARTTIME', choosetime(1, 0, maketime(1)));
             $apx->tmpl->assign('ENDTIME', choosetime(2, 1, maketime(2)));
         }
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('SECID', $_POST['secid']);
         $apx->tmpl->assign('GROUPS', $grouplist);
         $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title']));
         $apx->tmpl->assign('TEXT', compatible_hsc($_POST['text']));
         $apx->tmpl->assign('LINK', compatible_hsc($_POST['link']));
         $apx->tmpl->assign('IMAGE', iif($info['image'], getpath('uploads') . $info['image']));
         $apx->tmpl->assign('IMAGE_WIDTH', $imageWidth);
         $apx->tmpl->assign('DELIMAGE', (int) $_POST['delimage']);
         $apx->tmpl->parse('edit');
     }
 }
Beispiel #8
0
 function pictures()
 {
     global $set, $db, $apx;
     //Notwendig weil 1.7.0 beim Kopieren ein Bild mit ID 0 erzeugt hatte :/
     if (isset($_REQUEST['delpic'])) {
         $_REQUEST['delpic'] = (int) $_REQUEST['delpic'];
     } else {
         $_REQUEST['delpic'] = null;
     }
     //Bilder auslesen
     list($pictures, $nextid) = $db->first("SELECT pictures,pictures_nextid FROM " . PRE . "_articles WHERE id='" . $_REQUEST['id'] . "'");
     $pictures = unserialize($pictures);
     if (!is_array($pictures)) {
         $pictures = array();
     }
     //Bild löschen
     if (isset($_REQUEST['delpic']) && isset($pictures[$_REQUEST['delpic']])) {
         if ($_POST['delpic']) {
             if (!checkToken()) {
                 printInvalidToken();
             } else {
                 $picinfo = $pictures[$_REQUEST['delpic']];
                 require BASEDIR . 'lib/class.mediamanager.php';
                 $mm = new mediamanager();
                 if ($picinfo['thumbnail'] && file_exists(BASEDIR . getpath('uploads') . $picinfo['thumbnail'])) {
                     $mm->deletefile($picinfo['thumbnail']);
                 }
                 if ($picinfo['picture'] && file_exists(BASEDIR . getpath('uploads') . $picinfo['picture'])) {
                     $mm->deletefile($picinfo['picture']);
                 }
                 unset($pictures[$_REQUEST['delpic']]);
                 $db->query("UPDATE " . PRE . "_articles SET pictures='" . addslashes(serialize($pictures)) . "' WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
                 printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=pics');
             }
         } else {
             tmessageOverlay('picdel', array('ID' => $_REQUEST['id'], 'DELPIC' => $_REQUEST['delpic']));
         }
     } elseif ($_POST['send']) {
         require BASEDIR . 'lib/class.mediamanager.php';
         $mm = new mediamanager();
         require_once BASEDIR . 'lib/class.image.php';
         $img = new image();
         //Bilder abarbeiten
         for ($i = 1; $i <= 5; $i++) {
             if (!$_FILES['upload' . $i]['tmp_name']) {
                 continue;
             }
             $ext = strtolower($mm->getext($_FILES['upload' . $i]['name']));
             if ($ext == 'gif') {
                 $ext = 'jpg';
             }
             $newname = 'pic' . '-' . $_POST['id'] . '-' . $nextid . '.' . $ext;
             $newfile = 'articles/gallery/' . $newname;
             $thumbname = 'pic' . '-' . $_POST['id'] . '-' . $nextid . '-thumb.' . $ext;
             $thumbfile = 'articles/gallery/' . $thumbname;
             //Erfolgreichen Upload prüfen
             if (!$mm->uploadfile($_FILES['upload' . $i], 'articles/gallery', $newname)) {
                 continue;
             }
             //Bild einlesen
             list($picture, $picturetype) = $img->getimage($newfile);
             //////// THUMBNAIL
             $thumbnail = $img->resize($picture, $set['articles']['thumbwidth'], $set['articles']['thumbheight'], $set['articles']['artpic_quality']);
             $img->saveimage($thumbnail, $picturetype, $thumbfile);
             //////// BILD
             //Bild skalieren
             if ($picture !== false && !$_POST['noresize' . $i] && $set['articles']['picwidth'] && $set['articles']['picheight']) {
                 $scaled = $img->resize($picture, $set['articles']['picwidth'], $set['articles']['picheight'], $set['articles']['artpic_quality'], 0);
                 if ($scaled != $picture) {
                     imagedestroy($picture);
                 }
                 $picture = $scaled;
             }
             //Wasserzeichen einfügen
             if ($picture !== false && $set['articles']['watermark'] && $_POST['watermark' . $i]) {
                 $watermarked = $img->watermark($picture, $set['articles']['watermark'], $set['articles']['watermark_position'], $set['articles']['watermark_transp']);
                 if ($watermarked != $picture) {
                     imagedestroy($picture);
                 }
                 $picture = $watermarked;
             }
             //Bild erstellen
             $img->saveimage($picture, $picturetype, $newfile);
             //Cleanup
             imagedestroy($picture);
             imagedestroy($thumbnail);
             unset($picture, $thumbnail);
             $pictures[$nextid] = array('picture' => $newfile, 'thumbnail' => $thumbfile);
             ++$nextid;
         }
         //Bilder eintragen
         $db->query("UPDATE " . PRE . "_articles SET pictures='" . addslashes(serialize($pictures)) . "',pictures_nextid='" . intval($nextid) . "' WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
         //Artikel beenden
         if ($_POST['submit_finish']) {
             $this->finish_article();
             return;
         } else {
             printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=pics');
         }
     } else {
         echo '<h2>' . $apx->lang->get(iif($this->type == 'normal', 'ARTICLE', strtoupper($this->type))) . ': ' . $this->title . '</h2>';
         //Bilderserie auflisten
         foreach ($pictures as $id => $res) {
             ++$i;
             $picdata[$i]['ID'] = $id;
             $picdata[$i]['IMAGE'] = HTTPDIR . getpath('uploads') . $res['thumbnail'];
             $picdata[$i]['LINK'] = HTTPDIR . getpath('uploads') . $res['picture'];
             $picdata[$i]['OPTIONS'] .= optionHTMLOverlay('del.gif', $_REQUEST['action'], 'id=' . $_REQUEST['id'] . '&pageid=pics&delpic=' . $id . '&pubnow=' . $_REQUEST['pubnow'], $apx->lang->get('CORE_DEL'));
         }
         $apx->tmpl->assign('SET_WATERMARK', iif($set['articles']['watermark'], 1, 0));
         $apx->tmpl->assign('SET_NORESIZE', iif($set['articles']['picwidth'] && $set['articles']['picheight'], 1, 0));
         $apx->tmpl->assign('PIC', $picdata);
         $apx->tmpl->assign('PUBNOW', (int) $_REQUEST['pubnow']);
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('ACTION', iif($_REQUEST['action'] == 'articles.add', 'add', 'edit'));
         $apx->tmpl->parse('pictures');
     }
 }
Beispiel #9
0
 //BILDER HOCHLADEN
 if ($_REQUEST['do'] == 'add') {
     if ($_POST['send']) {
         require_once BASEDIR . 'lib/class.mediamanager.php';
         $mm = new mediamanager();
         //Dateien temporär hochladen
         $files = array();
         for ($i = 1; $i <= 3; $i++) {
             if (!$_FILES['upload' . $i]['tmp_name']) {
                 continue;
             }
             //Erfolgreichen Upload prüfen
             if (!$mm->uploadfile($_FILES['upload' . $i], 'temp', $mm->getfile($_FILES['upload' . $i]['tmp_name']))) {
                 continue;
             }
             $ext = strtolower($mm->getext($_FILES['upload' . $i]['name']));
             if ($ext == 'gif') {
                 $ext = 'jpg';
             }
             $files[] = array('ext' => $ext, 'source' => 'temp/' . $mm->getfile($_FILES['upload' . $i]['tmp_name']), 'caption' => $_POST['caption' . $i]);
         }
         //Bilderzahl auslesen
         $piccount = 0;
         if ($set['user']['gallery_maxpics']) {
             $data = $db->fetch("SELECT id FROM " . PRE . "_user_gallery WHERE owner='" . $user->info['userid'] . "'");
             $galids = get_ids($data, 'id');
             if (count($galids)) {
                 list($piccount) = $db->first("SELECT count(id) FROM " . PRE . "_user_pictures WHERE galid IN (" . implode(',', $galids) . ")");
             }
         }
         //Akzeptierte Dateien verarbeiten
Beispiel #10
0
 function padd()
 {
     global $set, $db, $apx, $html;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     @set_time_limit(600);
     if ($_POST['send'] == 1) {
         if (!checkToken()) {
             infoInvalidToken();
         } else {
             $files = array();
             require_once BASEDIR . 'lib/class.mediamanager.php';
             $mm = new mediamanager();
             //ZIP
             if ($_REQUEST['what'] == 'zip' && $_FILES['zip']['tmp_name']) {
                 $mm->uploadfile($_FILES['zip'], 'gallery/uploads', $mm->getfile($_FILES['zip']['tmp_name']));
                 $zipfile = zip_open(BASEDIR . getpath('uploads') . 'gallery/uploads/' . $mm->getfile($_FILES['zip']['tmp_name']));
                 while ($zipentry = zip_read($zipfile)) {
                     if (zip_entry_open($zipfile, $zipentry, 'r')) {
                         if (substr(zip_entry_name($zipentry), -1) == '/') {
                             continue;
                         }
                         $content = zip_entry_read($zipentry, zip_entry_filesize($zipentry));
                         $zipname = str_replace('/', '%1%', zip_entry_name($zipentry));
                         $outfilepath = 'gallery/uploads/' . $zipname;
                         zip_entry_close($zipentry);
                         //Datei schreiben
                         $outfile = fopen(BASEDIR . getpath('uploads') . $outfilepath, 'w');
                         fwrite($outfile, $content);
                         fclose($outfile);
                         $ext = strtolower($mm->getext($outfilepath));
                         if ($ext == 'gif') {
                             $ext = 'jpg';
                         }
                         $files[] = array('ext' => $ext, 'source' => $outfilepath, 'watermark' => $_POST['watermark'], 'noresize' => $_POST['noresize'], 'allowcoms' => $_POST['allowcoms'], 'allowrating' => $_POST['allowrating'], 'caption' => $_POST['caption']);
                     }
                 }
                 zip_close($zipfile);
                 $mm->deletefile('gallery/uploads/' . $mm->getfile($_FILES['zip']['tmp_name']));
             } elseif ($_REQUEST['what'] == 'ftp') {
                 if (!is_array($_POST['ftp'])) {
                     $_POST['ftp'] = array();
                 }
                 require_once BASEDIR . 'lib/class.mediamanager.php';
                 $mm = new mediamanager();
                 foreach ($_POST['ftp'] as $key => $file) {
                     $file = $mm->securefile($file);
                     $ext = strtolower($mm->getext($file));
                     if ($ext == 'gif') {
                         $ext = 'jpg';
                     }
                     $files[] = array('ext' => $ext, 'source' => 'gallery/uploads/' . $file, 'watermark' => $_POST['watermark' . $key], 'noresize' => $_POST['noresize' . $key], 'allowcoms' => $_POST['allowcoms' . $key], 'allowrating' => $_POST['allowrating' . $key], 'caption' => $_POST['caption' . $key]);
                 }
             } else {
                 for ($i = 1; $i <= $set['gallery']['addpics']; $i++) {
                     if (!$_FILES['upload' . $i]['tmp_name']) {
                         continue;
                     }
                     //Erfolgreichen Upload prüfen
                     if (!$mm->uploadfile($_FILES['upload' . $i], 'gallery/uploads', $mm->getfile($_FILES['upload' . $i]['tmp_name']))) {
                         continue;
                     }
                     $ext = strtolower($mm->getext($_FILES['upload' . $i]['name']));
                     if ($ext == 'gif') {
                         $ext = 'jpg';
                     }
                     $files[] = array('ext' => $ext, 'source' => 'gallery/uploads/' . $mm->getfile($_FILES['upload' . $i]['tmp_name']), 'watermark' => $_POST['watermark' . $i], 'noresize' => $_POST['noresize' . $i], 'allowcoms' => $_POST['allowcoms' . $i], 'allowrating' => $_POST['allowrating' . $i], 'caption' => $_POST['caption' . $i]);
                 }
             }
             $this->process_files($files);
             //Gallery Updatetime
             $this->setGalleryUpdatetime($_REQUEST['id']);
             //Weitere Bilder anfügen
             if ($_POST['addnext']) {
                 printJSRedirect('action.php?action=gallery.padd&id=' . $_REQUEST['id'] . '&updateparent=' . $_REQUEST['updateparent']);
             } else {
                 if ($_REQUEST['updateparent']) {
                     printJSUpdateObject($_REQUEST['updateparent'], get_gallery_list($_REQUEST['id']));
                 } else {
                     printJSRedirect('action.php?action=gallery.pshow&id=' . $_REQUEST['id']);
                 }
             }
         }
     } else {
         //Layer
         $layerdef[] = array('LAYER_UPLOAD', 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;updateparent=' . $_REQUEST['updateparent'], !$_REQUEST['what']);
         $layerdef[] = array('LAYER_ZIP', 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=zip&amp;updateparent=' . $_REQUEST['updateparent'], $_REQUEST['what'] == 'zip');
         $layerdef[] = array('LAYER_FTP', 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=ftp&amp;updateparent=' . $_REQUEST['updateparent'], $_REQUEST['what'] == 'ftp');
         if (!function_exists('zip_open')) {
             unset($layerdef[1]);
         }
         $html->layer_header($layerdef);
         //ZIP
         if ($_REQUEST['what'] == 'zip') {
             $apx->tmpl->assign('ID', $_REQUEST['id']);
             $apx->tmpl->assign('SET_OPTIONS', $apx->is_module('comments') && $set['gallery']['coms'] || $apx->is_module('ratings') && $set['gallery']['ratings'] || $set['gallery']['watermark'] || $set['gallery']['picwidth'] && $set['gallery']['picheight']);
             $apx->tmpl->assign('SET_COMS', $apx->is_module('comments') && $set['gallery']['coms']);
             $apx->tmpl->assign('SET_RATING', $apx->is_module('ratings') && $set['gallery']['ratings']);
             $apx->tmpl->assign('SET_WATERMARK', iif($set['gallery']['watermark'], 1, 0));
             $apx->tmpl->assign('SET_NORESIZE', iif($set['gallery']['picwidth'] && $set['gallery']['picheight'], 1, 0));
             $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
             $apx->tmpl->parse('padd_zip');
         } elseif ($_REQUEST['what'] == 'ftp') {
             require_once BASEDIR . 'lib/class.mediamanager.php';
             $mm = new mediamanager();
             $extensions = array('jpg', 'jpeg', 'jpe', 'png', 'gif');
             $files = array();
             $dirs = array();
             if (is_dir(BASEDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/'))) {
                 $dir = opendir(BASEDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/'));
                 while ($file = readdir($dir)) {
                     if ($file == '.' || $file == '..') {
                         continue;
                     }
                     //Ordner
                     if (is_dir(BASEDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file)) {
                         $dirs[] = $file;
                         continue;
                     }
                     //Datei
                     if (!in_array(strtolower($mm->getext($file)), $extensions)) {
                         continue;
                     }
                     $files[] = $file;
                 }
                 closedir($dir);
             }
             sort($files);
             sort($dirs);
             //Ordner auflisten
             foreach ($dirs as $dir) {
                 ++$i;
                 $subdir[$i]['NAME'] = $dir;
                 $subdir[$i]['LINK'] = 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=ftp&amp;dir=' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $dir;
             }
             //Dateien auflisten
             foreach ($files as $file) {
                 ++$i;
                 $upload[$i]['FILE'] = $file;
                 $upload[$i]['FILEID'] = iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file;
                 $upload[$i]['LINK'] = HTTPDIR . getpath('uploads') . 'gallery/uploads/' . iif($_REQUEST['dir'], $_REQUEST['dir'] . '/') . $file;
             }
             //Pfad erstellen
             $pp = explode('/', $_REQUEST['dir']);
             if ($_REQUEST['dir'] && count($pp)) {
                 foreach ($pp as $dirname) {
                     ++$i;
                     $path .= iif($path, '/') . $dirname;
                     $pathdata[$i]['NAME'] = $dirname;
                     $pathdata[$i]['LINK'] = 'action.php?action=gallery.padd&amp;id=' . $_REQUEST['id'] . '&amp;what=ftp&amp;dir=' . $path;
                 }
             }
             $apx->tmpl->assign('ID', $_REQUEST['id']);
             $apx->tmpl->assign('FTP', $upload);
             $apx->tmpl->assign('DIR', $subdir);
             $apx->tmpl->assign('PATH', $pathdata);
             $apx->tmpl->assign('SET_OPTIONS', $apx->is_module('comments') && $set['gallery']['coms'] || $apx->is_module('ratings') && $set['gallery']['ratings'] || $set['gallery']['watermark'] || $set['gallery']['picwidth'] && $set['gallery']['picheight']);
             $apx->tmpl->assign('SET_COMS', $apx->is_module('comments') && $set['gallery']['coms']);
             $apx->tmpl->assign('SET_RATING', $apx->is_module('ratings') && $set['gallery']['ratings']);
             $apx->tmpl->assign('SET_WATERMARK', iif($set['gallery']['watermark'], 1, 0));
             $apx->tmpl->assign('SET_NORESIZE', iif($set['gallery']['picwidth'] && $set['gallery']['picheight'], 1, 0));
             $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
             $apx->tmpl->parse('padd_ftp');
         } else {
             for ($i = 1; $i <= $set['gallery']['addpics']; $i++) {
                 $upload[$i]['ASD'] = 1;
             }
             $apx->tmpl->assign('ID', $_REQUEST['id']);
             $apx->tmpl->assign('UPLOAD', $upload);
             $apx->tmpl->assign('SET_COMS', $apx->is_module('comments') && $set['gallery']['coms']);
             $apx->tmpl->assign('SET_RATING', $apx->is_module('ratings') && $set['gallery']['ratings']);
             $apx->tmpl->assign('SET_WATERMARK', iif($set['gallery']['watermark'], 1, 0));
             $apx->tmpl->assign('SET_NORESIZE', iif($set['gallery']['picwidth'] && $set['gallery']['picheight'], 1, 0));
             $apx->tmpl->assign('UPDATEPARENT', (int) $_REQUEST['updateparent']);
             $apx->tmpl->parse('padd_upload');
         }
         //Layer Ende
         $html->layer_footer();
     }
 }