Beispiel #1
0
function obOutputHandler($OutputHtml)
{
    global $EnableGZipEncoding;
    //-- Play with HTML before output
    //$OutputHtml = playWithHtml($OutputHtml);
    //-- If GZIP not supported compression is pointless.
    // If headers were sent we can not signal GZIP encoding as
    // we will mess it all up so better drop it here!
    // If you disable GZip encoding to use plain output buffering we stop here too!
    if (!acceptsGZip() || headers_sent() || !$EnableGZipEncoding) {
        return $OutputHtml;
    }
    //-- We signal GZIP compression and dump encoded data
    $OutputHtml .= '<!-- Gzip compressed | old-size: ' . goodsize(strlen($OutputHtml)) . ' new-size: ' . goodsize(strlen(gzencode($OutputHtml))) . ' -->';
    header("Content-Encoding: gzip");
    return gzencode($OutputHtml);
}
Beispiel #2
0
function getTSInfo($ip, $port, $tPort)
{
    $out = "";
    $fp = fsockopen($ip, $tPort, $errno, $errstr, 30);
    if ($fp) {
        fputs($fp, "sel " . $port . "\n");
        fputs($fp, "si\n");
        fputs($fp, "quit\n");
        while (!feof($fp)) {
            $out .= fgets($fp, 1024);
        }
        $out = str_replace("[TS]", "", $out);
        $out = str_replace("OK", "", $out);
        $out = trim($out);
        $data['send'] = goodsize((double) substr($out, indexOf($out, "server_bytessend=")));
        $data['recv'] = goodsize((double) substr($out, indexOf($out, "server_bytesreceived=")));
        $name = substr($out, indexOf($out, "server_name="), strlen($out));
        $name = substr($name, 0, indexOf($name, "server_platform=") - strlen("server_platform="));
        $data['name'] = $name;
        $os = substr($out, indexOf($out, "server_platform="), strlen($out));
        $os = substr($os, 0, indexOf($os, "server_welcomemessage=") - strlen("server_welcomemessage="));
        $data['os'] = $os;
        $uptime = substr($out, indexOf($out, "server_uptime="), strlen($out));
        $uptime = substr($uptime, 0, indexOf($uptime, "server_currrentusers=") - strlen("server_currrentusers="));
        $data['uptime'] = goodtime((int) $uptime, 1);
        $cAmount = substr($out, indexOf($out, "server_currentchannels="), strlen($out));
        $cAmount = substr($cAmount, 0, indexOf($cAmount, "server_bwinlastsec=") - strlen("server_bwinlastsec="));
        $data['cAmount'] = $cAmount;
        $user = substr($out, indexOf($out, "server_currentusers="), strlen($out));
        $user = substr($user, 0, indexOf($user, "server_currentchannels=") - strlen("server_currentchannels="));
        $data['user'] = $user;
        $max = substr($out, indexOf($out, "server_maxusers="), strlen($out));
        $max = substr($max, 0, indexOf($max, "server_allow_codec_celp51=") - strlen("server_allow_codec_celp51="));
        $data['max'] = $max;
        /* Alter HTML above */
        fclose($fp);
        return @$data;
    }
}
Beispiel #3
0
function account_user_upload()
{
    global $db;
    if ($db->result(DB_PRE . 'ecp_user', 'user_pic', 'ID = ' . $_SESSION['userID']) != '') {
        table(ERROR, ACCOUNT_USERPIC_EXIST);
        account_user_pics();
    } else {
        if ($_FILES['user']['size'] > USER_PIC_MAX) {
            table(ERROR, str_replace('{oversize}', goodsize($_FILES['user']['size'] - USER_PIC_MAX), ACCOUNT_USERPIC_TO_BIG));
            account_user_pics();
        } elseif (count(getimagesize($_FILES['user']['tmp_name'])) < 2) {
            table(ERROR, ACCOUNT_WRONG_FILE_TYPE);
            account_user_pics();
        } else {
            $size = getimagesize($_FILES['user']['tmp_name']);
            print_r($size);
            $xmore = $size[0] - USER_PIC_X;
            $ymore = $size[1] - USER_PIC_Y;
            $sha1 = sha1_file($_FILES['user']['tmp_name']) . '.' . str_replace('image/', '', $size['mime']);
            if (($xmore > 0 or $ymore > 0) and ($size['mime'] == 'image/jpeg' or $size['mime'] == 'image/pjpeg' or $size['mime'] == 'image/jpg')) {
                if ($xmore > $ymore) {
                    resize_picture($_FILES['user']['tmp_name'], USER_PIC_X, 'images/user/' . $_SESSION['userID'] . '_' . $sha1, 85, 1);
                } else {
                    resize_picture($_FILES['user']['tmp_name'], USER_PIC_Y, 'images/user/' . $_SESSION['userID'] . '_' . $sha1, 85, 0);
                }
                if ($db->query('UPDATE ' . DB_PRE . 'ecp_user SET user_pic = \'' . strsave($sha1) . '\' WHERE ID = ' . $_SESSION['userID'])) {
                    header1('?section=account&action=avatar');
                }
            } elseif ($size[0] > USER_PIC_X or $size[1] > USER_PIC_Y) {
                table(ERROR, ACCOUNT_USERPIC_TO_BIG2);
                account_user_pics();
            } else {
                if (move_uploaded_file($_FILES['user']['tmp_name'], 'images/user/' . $_SESSION['userID'] . '_' . $sha1)) {
                    umask(0);
                    chmod('images/user/' . $_SESSION['userID'] . '_' . $sha1, CHMOD);
                    if ($db->query('UPDATE ' . DB_PRE . 'ecp_user SET user_pic = \'' . strsave($sha1) . '\' WHERE ID = ' . $_SESSION['userID'])) {
                        header1('?section=account&action=avatar');
                    }
                }
            }
        }
    }
}
Beispiel #4
0
function get_ordner_inhalt($ordner, $pfad)
{
    $files = scan_dir($ordner . '/' . $pfad, true);
    $tpl = new smarty();
    $tpl->assign('ordner', $pfad);
    $tpl->assign('sid', session_name() . '=' . session_id());
    if ($pfad != '') {
        $folders = array(array('name' => '..', 'back' => substr($pfad, 0, strrpos($pfad, '/'))));
        $pfad .= '/';
        $array = explode('/', $pfad);
        foreach ($array as $value) {
            if ($value != '') {
                @($spe .= '/<a href="#" onclick="load_dir(\'' . @$spe2 . '/' . $value . '\'); return false;">' . $value . '</a>');
                @($spe2 .= '/' . $value);
            }
        }
        $tpl->assign('navi', @$spe);
    } else {
        $folders = array();
    }
    $dateien = array();
    if (count($files)) {
        foreach ($files as $value) {
            $sub = array();
            if (is_dir($ordner . '/' . $pfad . $value)) {
                $sub['name'] = $value;
                $folders[] = $sub;
            } else {
                $sub['name'] = $value;
                $sub['size'] = filesize($ordner . '/' . $pfad . $value);
                $sub['filesize'] = goodsize($sub['size']);
                $icon = substr($value, strrpos($value, '.') + 1);
                file_exists('images/file_icons/' . $icon . '.png') ? $sub['icon'] = $icon . '.png' : ($sub['icon'] = 'file.png');
                $dateien[] = $sub;
            }
        }
    }
    $tpl->assign('folders', $folders);
    $tpl->assign('files', $dateien);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/browser' . (UPLOAD_METHOD == 'old' ? '_old' : '') . '.html');
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Beispiel #5
0
    $tpl->assign('installed', date('d.m.Y', $installed));
    $tpl->assign('tage', floor($tage));
    $tpl->assign('visits', format_nr($row['visits']));
    $tpl->assign('hits', format_nr($row['hits']));
    $tpl->assign('messages', format_nr(mysql_result($db->query('SHOW TABLE STATUS LIKE "%ecp_messages"'), 0, 'Auto_increment') - 1));
    $tpl->assign('awards', $db->result(DB_PRE . 'ecp_awards', 'COUNT(awardID)', '1'));
    $tpl->assign('news', format_nr($db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', '1')));
    $tpl->assign('surveys', format_nr($db->result(DB_PRE . 'ecp_survey', 'COUNT(surveyID)', '1')));
    $tpl->assign('clanwars', format_nr($db->result(DB_PRE . 'ecp_wars', 'COUNT(warID)', '1')));
    $tpl->assign('comments', format_nr($db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich != "guestbook"')));
    $tpl->assign('members', format_nr($db->result(DB_PRE . 'ecp_user', 'COUNT(ID)', '1')));
    $row = $db->fetch_assoc('SELECT username, ID, registerdate FROM ' . DB_PRE . 'ecp_user ORDER BY registerdate DESC LIMIT 1');
    $tpl->assign('lastmember', '<a href="?section=user&id=' . $row['ID'] . '">' . $row['username'] . '</a> (' . date('d.m.Y', $row['registerdate']) . ')');
    $row = $db->fetch_assoc('SELECT SUM(traffic) as traffic, COUNT(*) as anzahl FROM ' . DB_PRE . 'ecp_downloads');
    $tpl->assign('downloads', format_nr($row['anzahl']));
    $tpl->assign('traffic', goodsize($row['traffic']));
    $tpl->assign('money', format_nr($db->result(DB_PRE . 'ecp_user_stats', 'SUM(money)', '1')));
    $tpl->assign('members', format_nr($db->result(DB_PRE . 'ecp_user', 'COUNT(ID)', '1')));
    $row = $db->fetch_assoc('SELECT SUM(images) as images, COUNT(*) as gallery FROM ' . DB_PRE . 'ecp_gallery');
    $tpl->assign('images', format_nr($row['images']));
    $tpl->assign('galleries', format_nr($row['gallery']));
    $row = $db->fetch_assoc('SELECT SUM(threads) as threads, SUM(posts) AS posts FROM ' . DB_PRE . 'ecp_forum_boards');
    $tpl->assign('threads', format_nr($row['threads']));
    $tpl->assign('posts', format_nr($row['posts']));
    ob_start();
    $tpl->display(DESIGN . '/tpl/stats/overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(STATS, $content, '', 1);
} else {
    table(ACCESS_DENIED, NO_ACCESS_RIGHTS);
Beispiel #6
0
    if (@$_SESSION['rights']['public']['downloads']['view'] or @$_SESSION['rights']['superadmin']) {
        $db->query('SELECT dID,	name, a.userID, info, 
					a.homepage, version, size, traffic, downloads, 
					a.datum, COUNT(comID) as comments, username, kname, country
					FROM ' . DB_PRE . 'ecp_downloads as a
					LEFT JOIN ' . DB_PRE . 'ecp_downloads_kate as b ON (kID = cID)
					LEFT JOIN ' . DB_PRE . 'ecp_user ON (a.userID = ID) 
					LEFT JOIN ' . DB_PRE . 'ecp_comments ON (bereich = "downloads" AND subID = dID) 
					WHERE (a.access = "" OR ' . str_replace('access', 'a.access', $_SESSION['access_search']) . ') AND (b.access = "" OR ' . str_replace('access', 'b.access', $_SESSION['access_search']) . ')
					GROUP BY dID
					ORDER BY datum DESC LIMIT ' . LIMIT_LAST_THREADS);
        if ($db->num_rows()) {
            $tpls = new smarty();
            $dls = array();
            while ($row1 = $db->fetch_assoc()) {
                $row1['size'] = goodsize($row1['size']);
                $row1['traffic'] = goodsize($row1['traffic']);
                $row1['datum'] = date(LONG_DATE, $row1['datum']);
                $dls[] = $row1;
            }
            $tpls->assign('dls', $dls);
            $tpls->display(DESIGN . '/tpl/modul/lastdownloads.html');
        } else {
            echo NO_ENTRIES;
        }
    } else {
        echo NO_ACCESS_RIGHTS;
    }
} else {
    echo 'Kein direktes Aufrufen der Datei!';
}
Beispiel #7
0
function forum_search_results($id)
{
    global $db;
    if ($id) {
        $search = $db->fetch_assoc('SELECT * FROM ' . DB_PRE . 'ecp_forum_search WHERE (SID = \'' . session_id() . '\' OR userID = ' . (int) @$_SESSION['userID'] . ') AND searchID = ' . $id);
        if (isset($search['searchID'])) {
            if ($search['stichwort'] != '') {
                if ($search['viewas'] == 'comments') {
                    $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_FORUM_COMMENTS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_FORUM_COMMENTS);
                    $comments = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['adatum'] = forum_make_date($row['adatum']);
                        $row['nr'] = ++$limits[1];
                        $row['countryname'] = @$countries[$row['country']];
                        $row['sex'] == 'male' ? $row['sextext'] = MALE : ($row['sextext'] = FEMALE);
                        if ($row['edits']) {
                            $row['edit'] = str_replace(array('{anzahl}', '{von}', '{last}'), array($row['edits'], '<a href="?section=user&id=' . $row['edituserID'] . '">' . $row['editfrom'] . '</a>', date(LONG_DATE, $row['editdatum'])), COMMENT_EDIT_TXT);
                        }
                        if ($row['attachs']) {
                            $anhaenge = array();
                            $db->query('SELECT `attachID`, `name`, `size`, `downloads` FROM `' . DB_PRE . 'ecp_forum_attachments` WHERE `bID` = ' . $row['bID'] . ' AND `tID` = ' . $row['tID'] . ' AND `mID` = ' . $row['comID']);
                            while ($sub = $db->fetch_assoc()) {
                                $sub['size'] = goodsize($sub['size']);
                                $anhaenge[] = $sub;
                            }
                            $row['attchs'] = $anhaenge;
                        }
                        $comments[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('comments', $comments);
                    $tpl->assign('words', str_replace(array('AND', 'OR'), array('<strong>AND</strong>', '<strong>OR</strong>'), $search['stichwort']));
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_comments.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                } else {
                    if ($search['sortart'] == 'adatum') {
                        $search['sortart'] = 'lastreplay';
                    }
                    $db->query($search['sqlquery']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_THREADS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_THREADS);
                    $threads = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['lastreplay'] = forum_make_date($row['lastreplay']);
                        $row['datum'] = forum_make_date($row['datum']);
                        $row['bewertung'] = $row['ratingvotes'] != 0 ? str_replace(array('{anzahl}', '{avg}'), array(format_nr($row['ratingvotes']), format_nr($row['rating'], 2)), FORUM_RATING_VAL) : FORUM_NO_RATINGS;
                        $row['bewertungbild'] = 'rating_' . str_replace('.', '_', get_forum_rating($row['rating']));
                        $threads[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('threads', $threads);
                    $tpl->assign('words', str_replace(array('AND', 'OR'), array('<strong>AND</strong>', '<strong>OR</strong>'), $search['stichwort']));
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_boards.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                }
            } else {
                if ($search['usersuchart'] == 1) {
                    if ($search['sortart'] == 'adatum') {
                        $search['sortart'] == 'datum';
                    }
                    $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_FORUM_COMMENTS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_FORUM_COMMENTS);
                    $comments = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['adatum'] = forum_make_date($row['adatum']);
                        $row['nr'] = ++$limits[1];
                        $row['countryname'] = @$countries[$row['country']];
                        $row['sex'] == 'male' ? $row['sextext'] = MALE : ($row['sextext'] = FEMALE);
                        if ($row['edits']) {
                            $row['edit'] = str_replace(array('{anzahl}', '{von}', '{last}'), array($row['edits'], '<a href="?section=user&id=' . $row['edituserID'] . '">' . $row['editfrom'] . '</a>', date(LONG_DATE, $row['editdatum'])), COMMENT_EDIT_TXT);
                        }
                        if ($row['attachs']) {
                            $anhaenge = array();
                            $db->query('SELECT `attachID`, `name`, `size`, `downloads` FROM `' . DB_PRE . 'ecp_forum_attachments` WHERE `bID` = ' . $row['bID'] . ' AND `tID` = ' . $row['tID'] . ' AND `mID` = ' . $row['comID']);
                            while ($sub = $db->fetch_assoc()) {
                                $sub['size'] = goodsize($sub['size']);
                                $anhaenge[] = $sub;
                            }
                            $row['attchs'] = $anhaenge;
                        }
                        $comments[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('search', 'username');
                    $tpl->assign('username', $search['fromusername']);
                    $tpl->assign('comments', $comments);
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_comments.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                } else {
                    if ($search['sortart'] == 'adatum') {
                        $search['sortart'] = 'lastreplay';
                    }
                    $db->query($search['sqlquery']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_THREADS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_THREADS);
                    $threads = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['lastreplay'] = forum_make_date($row['lastreplay']);
                        $row['datum'] = forum_make_date($row['datum']);
                        $row['bewertung'] = $row['ratingvotes'] != 0 ? str_replace(array('{anzahl}', '{avg}'), array(format_nr($row['ratingvotes']), format_nr($row['rating'], 2)), FORUM_RATING_VAL) : FORUM_NO_RATINGS;
                        $row['bewertungbild'] = 'rating_' . str_replace('.', '_', get_forum_rating($row['rating']));
                        $threads[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('search', 'username');
                    $tpl->assign('username', $search['fromusername']);
                    $tpl->assign('threads', $threads);
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_boards.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                }
            }
        } else {
            table(ERROR, FORUM_SEARCH_NOT_YOURS);
        }
    }
}
Beispiel #8
0
             if (isset($error)) {
                 echo $error . '<br /><a href="?section=admin&site=clanwars">Back to Page</a>';
             } else {
                 header1('index.php?section=admin&site=clanwars');
             }
         }
     } else {
         $result = $db->query('SELECT scoreID, locationname FROM ' . DB_PRE . 'ecp_wars_scores LEFT JOIN ' . DB_PRE . 'ecp_wars_locations ON (lID = locationID) WHERE wID = ' . (int) $_GET['id']);
         $maps = array();
         while ($row = mysql_fetch_assoc($result)) {
             $db->query('SELECT screenID, filename, uploaddate FROM ' . DB_PRE . 'ecp_wars_screens WHERE sID = ' . $row['scoreID']);
             $i = 1;
             while ($sub = $db->fetch_assoc()) {
                 $sub['i'] = $i++;
                 $sub['uploaddate'] = date(SHORT_DATE, $sub['uploaddate']);
                 $sub['size'] = goodsize(filesize('images/screens/' . $sub['filename']));
                 $row['screens'][] = $sub;
             }
             $maps[] = $row;
         }
         $tpl = new smarty();
         $tpl->assign('maps', $maps);
         $tpl->assign('sid', session_name() . '=' . session_id());
         $tpl->assign('id', (int) $_GET['id']);
         ob_start();
         $tpl->display(DESIGN . '/tpl/admin/clanwars_upload_screens' . (UPLOAD_METHOD == 'old' ? '_old' : '') . '.html');
         $content = ob_get_contents();
         ob_end_clean();
         echo html_ajax_convert($content);
     }
 } else {
Beispiel #9
0
function admin_database_optimize()
{
    if (@$_SESSION['rights']['admin']['database']['optimize'] or @$_SESSION['rights']['superadmin']) {
        global $db;
        $result = $db->query("SHOW TABLE STATUS");
        $gesamt = 0;
        $database = array();
        while ($row = mysql_fetch_assoc($result)) {
            @($free = $row['Data_free']);
            $gesamt += $free;
            @($groesse += $row['Data_length']);
            $sql = "OPTIMIZE TABLE " . $row['Name'];
            $row['Data_length'] = goodsize($row['Data_length']);
            $row['free'] = goodsize($free);
            $database[] = $row;
            $db->query($sql);
        }
        $db->query('UPDATE ' . DB_PRE . 'ecp_stats SET sqlfree = sqlfree + ' . $gesamt);
        $tpl = new smarty();
        $tpl->assign('dbsize', str_replace(array('{db_size}', '{free}'), array(goodsize($groesse), goodsize($gesamt)), DATABASE_INFO));
        $tpl->assign('new_free', str_replace('{free}', goodsize($db->result(DB_PRE . 'ecp_stats', 'sqlfree', '1')), DATABASE_INFO2));
        $tpl->assign('database', $database);
        ob_start();
        $tpl->display(DESIGN . '/tpl/admin/database_optimize.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(DATABASE_OPTIMIZE, $content, '', 1);
    } else {
        table(ERROR, NO_ADMIN_RIGHTS);
    }
}
Beispiel #10
0
function download_spezial()
{
    global $db;
    downloads();
    switch ($_GET['view']) {
        case 'new':
            $field = 'datum';
            break;
        case 'hits':
            $field = 'downloads';
            break;
        case 'traffic':
            $field = 'traffic';
            break;
        default:
            $field = 'datum';
    }
    $db->query('SELECT dID, name, ' . DB_PRE . 'ecp_downloads.userID, info, kID, subkID, kname, 
					' . DB_PRE . 'ecp_downloads.homepage, version, size, traffic, downloads, 
					' . DB_PRE . 'ecp_downloads.datum, COUNT(comID) as comments, username 
					FROM ' . DB_PRE . 'ecp_downloads 
					LEFT JOIN ' . DB_PRE . 'ecp_user ON (' . DB_PRE . 'ecp_downloads.userID = ID) 
					LEFT JOIN ' . DB_PRE . 'ecp_comments ON (bereich = "downloads" AND subID = dID) 
					LEFT JOIN ' . DB_PRE . 'ecp_downloads_kate ON (kID = cID)
					WHERE ' . DB_PRE . 'ecp_downloads.access = "" OR ' . str_replace('access', DB_PRE . 'ecp_downloads.access', $_SESSION['access_search']) . ' 
					GROUP BY dID
					ORDER BY ' . $field . ' DESC LIMIT 15');
    if ($db->num_rows()) {
        $tpl = new smarty();
        $downloads = array();
        while ($row = $db->fetch_assoc()) {
            $row['size'] = goodsize($row['size']);
            $row['traffic'] = goodsize($row['traffic']);
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $row['downloads'] = number_format($row['downloads'], 0, ',', '.');
            $lang = json_decode($row['info'], true);
            if (isset($lang[LANGUAGE])) {
                $row['info'] = $lang[LANGUAGE];
            } else {
                $row['info'] = @$lang['de'];
            }
            $downloads[] = $row;
        }
        $tpl->assign('dls', $downloads);
        ob_start();
        $tpl->display(DESIGN . '/tpl/downloads/downloads.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(DOWNLOADS, $content, '', 1);
    } else {
        table(INFO, NO_ENTRIES);
    }
}