Example #1
0
<?php

require "../../inv.header.php";
$user = new user();
if ($user->gotpermission('is_admin')) {
    $upgrades = "ALTER TABLE {$group_table} ADD COLUMN alter_notes TINYINT(1) DEFAULT 0";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$group_table} ADD COLUMN can_upload TINYINT(1) DEFAULT 1";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$tag_history_table} ADD COLUMN ip VARCHAR(255) DEFAULT NULL";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$user_table} ADD COLUMN my_tags TEXT DEFAULT NULL";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$tag_history_table} ADD COLUMN total_amount BIGINT(99) UNSIGNED NOT NULL AUTO_INCREMENT AFTER `ip`, ADD PRIMARY KEY (`total_amount`)";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$forum_topic_table} ENGINE=InnoDB";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$group_table} ENGINE=InnoDB";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$note_table} ENGINE=InnoDB";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$note_history_table} ENGINE=InnoDB";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$parent_child_table} ENGINE=InnoDB";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$user_table} ADD COLUMN post_count INTEGER(11) UNSIGNED NOT NULL DEFAULT 0";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$user_table} ADD COLUMN record_score INTEGER(11) UNSIGNED NOT NULL DEFAULT 0";
    $db->query($upgrades) or print $db->error;
    $upgrades = "ALTER TABLE {$user_table} ADD COLUMN comment_count INTEGER(11) UNSIGNED NOT NULL DEFAULT 0";
    $db->query($upgrades) or print $db->error;
Example #2
0
<?php

require "../inv.header.php";
$user = new user();
$ip = $db->real_escape_string($_SERVER['REMOTE_ADDR']);
if ($user->banned_ip($ip)) {
    exit;
}
if (!$user->check_log()) {
    exit;
}
$user_id = $checked_user_id;
if (!$user->gotpermission('alter_notes')) {
    exit;
}
if (is_numeric($_GET['id']) && is_numeric($_GET['note']['post_id']) && is_numeric($_GET['note']['x']) && is_numeric($_GET['note']['y']) && is_numeric($_GET['note']['width']) && is_numeric($_GET['note']['height'])) {
    $id = $db->real_escape_string($_GET['id']);
    $x = $db->real_escape_string($_GET['note']['x']);
    $y = $db->real_escape_string($_GET['note']['y']);
    $width = $db->real_escape_string($_GET['note']['width']);
    $height = $db->real_escape_string($_GET['note']['height']);
    $body = $db->real_escape_string(htmlentities($_GET['note']['body'], ENT_QUOTES, 'UTF-8'));
    $body = str_replace("&lt;tn&gt;", "<tn>", $body);
    $body = str_replace("&lt;/tn&gt;", "</tn>", $body);
    $body = str_replace("&lt;br /&gt;", "<br />", $body);
    $body = str_replace("&lt;br&gt;", "<br />", $body);
    $body = str_replace("&lt;b&gt;", "<b>", $body);
    $body = str_replace("&lt;/b&gt;", "</b>", $body);
    $body = str_replace("&lt;i&gt;", "<i>", $body);
    $body = str_replace("&lt;/i&gt;", "</i>", $body);
    $post_id = $db->real_escape_string($_GET['note']['post_id']);
Example #3
0
		</script>
		<br /><br />
		<script type="text/javascript">
		//<![CDATA[
		var posts = {}; posts[' . $id . '] = {}; posts[' . $id . '].comments = {}; posts[' . $id . '].ignored = {}; var cthreshold = parseInt(readCookie(\'comment_threshold\')) || 0; var users = readCookie(\'user_blacklist\').split(/[, ]|%20+/g);
		//]]>
		</script>';
    $data = '';
    $data = ob_get_contents();
    ob_end_clean();
    $cache->save("cache/" . $id . "/post.cache", $data);
    echo str_replace("f6ca1c7d5d00a2a3fb4ea2f7edfa0f96a6d09c11717f39facabad2d724f16fbb", $domain, $data);
    flush();
}
$user = new user();
$got_permission = $user->gotpermission('delete_comments');
if (isset($_GET['pid']) && is_numeric($_GET['pid']) && $_GET['pid'] > "0") {
    $pid = ceil($_GET['pid']);
    $page = $pid;
} else {
    $page = 0;
    $pid = 0;
}
$data = '';
if (file_exists("cache/{$id}/comments.{$pid}.cache")) {
    $data = $cache->load("cache/{$id}/comments.{$pid}.cache");
}
if ($data !== false && $data != "" && $got_permission === false) {
    echo $data;
    flush();
} else {
Example #4
0
}
$pg = "forum2";
require "includes/header.php";
$query = "SELECT t1.id, t1.title, t1.post, t1.author, t1.creation_date, t2.creation_post FROM {$forum_post_table}  AS t1 JOIN {$forum_topic_table} AS t2 ON t2.id=t1.topic_id WHERE t1.topic_id='{$id}' ORDER BY id LIMIT {$page}, {$limit}";
$result = $db->query($query) or die(mysql_error());
print '<div style="margin-left: 15px; margin-right: 15px;"><div id="forum" class="response-list">';
while ($row = $result->fetch_assoc()) {
    $date_made = $misc->date_words($row['creation_date']);
    print '<div class="post"><div class="author">
		<h6 class="author"><a name="' . $row['id'] . '"></a><a href="index.php?page=account_profile&amp;uname=' . $row['author'] . '" style="font-size: 14px;">' . $row['author'] . '</a></h6>
		<span class="date">' . $date_made . ' </span>
		</div><div class="content">
		<h6 class="response-title">' . $row['title'] . '</h6>
		<div class="body">' . $misc->short_url($misc->swap_bbs_tags($misc->linebreaks($row['post']))) . '</div>
		<div class="footer">';
    if ($uname == $row['author'] || $user->gotpermission('edit_forum_posts')) {
        echo '<a href="#" onclick="showHide(\'c' . $row['id'] . '\'); return false;">edit</a> |';
    } else {
        echo '<a href="">edit</a> |';
    }
    echo ' <a href="#" onclick="javascript:document.getElementById(\'reply_box\').value=document.getElementById(\'reply_box\').value+\'[quote]' . $row['author'] . ' said:\\r\\n' . str_replace("'", "\\'", str_replace("\r\n", '\\r\\n', str_replace('&#039;', "'", $row['post']))) . '[/quote]\'; return false;">quote</a> ';
    if ($user->gotpermission('delete_forum_posts') && $row['id'] != $row['creation_post']) {
        print ' | <a href="index.php?page=forum&amp;s=remove&amp;pid=' . $id . '&amp;cid=' . $row['id'] . '">remove</a><br />';
    }
    if ($uname == $row['author'] || $user->gotpermission('edit_forum_posts')) {
        print '<form method="post" action="index.php?page=forum&amp;s=edit&amp;pid=' . $id . '&amp;cid=' . $row['id'] . '&amp;ppid=' . $page . '" style="display:none" id="c' . $row['id'] . '"><table><tr><td><input type="text" name="title" value="' . $row['title'] . '"/></td></tr><tr><td><textarea name="post" rows="4" cols="6" style="width: 450px; height: 150px;">' . $row['post'] . '</textarea></td></tr><tr><td><input type="submit" name="submit" value="Edit"/></td></tr></table></form>';
    }
    echo '</div></div></div>';
}
echo '<div class="paginator"><div id="paginator">';
$misc = new misc();
Example #5
0
<?php

require "../inv.header.php";
$user = new user();
$cache = new cache();
if (!$user->check_log()) {
    header('Location: ../index.php?page=account&s=home');
    exit;
}
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] != "") {
    $id = $db->real_escape_string($_GET['id']);
    if (isset($_GET['note_id']) && is_numeric($_GET['note_id']) && $_GET['note_id'] != "") {
        if (!$user->gotpermission('alter_notes')) {
            exit;
        }
        $note_id = $db->real_escape_string($_GET['note_id']);
        $query = "SELECT COUNT(*) FROM {$note_table} WHERE post_id='{$id}' AND id='{$note_id}'";
        $result = $db->query($query);
        $row = $result->fetch_assoc();
        if ($row['COUNT(*)'] == 1) {
            $result->free_result();
            $query = "DELETE FROM {$note_table} WHERE post_id='{$id}' AND id='{$note_id}'";
            $db->query($query);
            $query = "DELETE FROM {$note_history_table} WHERE post_id='{$id}' AND id='{$note_id}'";
            $db->query($query);
            $cache->destroy("cache/" . $id . "/post.cache");
            print $note_id;
        }
    } else {
        if (isset($_GET['removepost']) && $_GET['removepost'] == 1) {
            $image = new image();
Example #6
0
    print "Action failed: " . $row['reason'];
    exit;
}
if (!$user->check_log()) {
    exit;
}
if (isset($_POST['title']) && isset($_POST['post']) && isset($_GET['pid']) && $_GET['pid'] != "" && isset($_GET['cid']) && $_GET['cid'] != "" && isset($_GET['ppid']) && $_GET['ppid'] != "") {
    $pid = $db->real_escape_string($_GET['pid']);
    $cid = $db->real_escape_string($_GET['cid']);
    $ppid = $db->real_escape_string($_GET['ppid']);
    $uid = $checked_user_id;
    $uname = $checked_username;
    $query = "SELECT author FROM {$forum_post_table} WHERE topic_id='{$pid}' AND id='{$cid}' LIMIT 1";
    $result = $db->query($query) or die($db->error);
    $row = $result->fetch_assoc();
    if ($row['author'] == $uname || $user->gotpermission('edit_forum_posts')) {
        $title = $db->real_escape_string(htmlentities($_POST['title'], ENT_QUOTES, 'UTF-8'));
        $post = $db->real_escape_string(htmlentities($_POST['post'], ENT_QUOTES, 'UTF-8'));
        $query = "UPDATE {$forum_post_table} SET title='{$title}', post='{$post}' WHERE topic_id='{$pid}' AND id='{$cid}'";
        $db->query($query) or die($db->error);
    }
    header("Location:index.php?page=forum&s=view&id={$pid}&pid={$ppid}#{$cid}");
    exit;
} else {
    if (isset($_GET['pin']) && $_GET['pin'] != "" && is_numeric($_GET['pin']) && isset($_GET['id']) && is_numeric($_GET['id']) && isset($_GET['pid']) && is_numeric($_GET['pid'])) {
        if ($user->gotpermission('pin_forum_topics')) {
            $pin = $db->real_escape_string($_GET['pin']);
            $id = $db->real_escape_string($_GET['id']);
            $pid = $db->real_escape_string($_GET['pid']);
            if ($pin > 0) {
                $query = "UPDATE {$forum_topic_table} SET priority='1' WHERE id='{$id}'";
            if ($tcount <= 40) {
                $ttags = explode(" ", $tags);
                foreach ($ttags as $current) {
                    if ($current != "" && $current != " ") {
                        $gtags[$current] = $current;
                        ++$tcount;
                    }
                }
            }
            $images .= '<span class="thumb"><a id="p' . $row['id'] . '" href="index.php?page=post&amp;s=view&amp;id=' . $row['id'] . '"><img src="' . $thumbnail_url . '/' . $row['directory'] . '/thumbnail_' . $row['image'] . '" alt="post" border="0" title="' . $row['tags'] . ' score:' . $row['score'] . ' rating:' . $row['rating'] . '"/></a>
				<script type="text/javascript">
				//<![CDATA[
				posts[' . $row['id'] . '] = {\'tags\':\'' . strtolower(str_replace('\\', "&#92;", str_replace("'", "&#039;", $tags))) . '\'.split(/ /g), \'rating\':\'' . $row['rating'] . '\', \'score\':' . $row['score'] . ', \'user\':\'' . str_replace('\\', "&#92;", str_replace(' ', '%20', str_replace("'", "&#039;", $row['owner']))) . '\'}
				//]]>
				</script>';
            if ($user->gotpermission('admin_panel')) {
                $images .= '<br/><span class="postID" onClick="copyMe(this);">' . $row['id'] . '</span>';
            }
            $images .= "</span>";
            ++$tcount;
        }
        $result->free_result();
        if (isset($_GET['tags']) && $_GET['tags'] != "" && $_GET['tags'] != "all") {
            $ttags = $db->real_escape_string(str_replace("'", "&#039;", $_GET['tags']));
        } else {
            $ttags = "";
        }
        asort($gtags);
        /*Tags have been sorted in ascending order
        		Let's now grab the index count from database
        		Needs to be escaped before query is sent!
Example #8
0
}
if ($search != '') {
    $query = "SELECT COUNT(*) FROM {$forum_topic_table} as t1 JOIN {$forum_post_table} AS t2 ON (MATCH(t2.post) AGAINST({$search})>0.5)";
} else {
    $query = "SELECT COUNT(*) FROM {$forum_topic_table}";
}
$result = $db->query($query);
$row = $result->fetch_assoc();
$numrows = $row['COUNT(*)'];
if ($search != "") {
    $query = "SELECT t1.id, t1.topic, t1.last_updated, t1.priority, t1.author FROM {$forum_topic_table} AS t1 JOIN {$forum_post_table} AS t2 ON (MATCH(t2.post) AGAINST({$search})>0.5) ORDER BY t1.priority DESC, t1.last_updated DESC LIMIT {$page}, {$limit}";
} else {
    $query = "SELECT id, topic, last_updated, author, locked, priority FROM {$forum_topic_table}  ORDER BY priority DESC, last_updated DESC LIMIT {$page}, {$limit}";
}
$result = $db->query($query) or die($db->error());
if ($user->gotpermission('delete_forum_topics') || $user->gotpermission('pin_forum_topics')) {
    print '<th width="10%">Tools</th>';
}
echo '</tr>';
while ($row = $result->fetch_assoc()) {
    $que = "SELECT COUNT(*) FROM {$forum_post_table} WHERE topic_id='" . $row['id'] . "'";
    $res = $db->query($que) or die($db->error());
    $ret = $res->fetch_assoc();
    $replies = $ret['COUNT(*)'] - 1;
    $date_now = $misc->date_words($row['last_updated']);
    $sticky = "";
    $locked = "";
    if ($row['priority'] == "1") {
        $sticky = "Sticky: ";
    }
    if ($row['locked'] == "1") {
Example #9
0
//die("Maintenance mode. please try again in 1 hour.");
error_reporting(0);
ignore_user_abort(1);
$misc = new misc();
$userc = new user();
$ip = $db->real_escape_string($_SERVER['REMOTE_ADDR']);
if ($userc->banned_ip($ip)) {
    print "Action failed: " . $row['reason'];
    exit;
}
if (!$userc->check_log()) {
    if (!$anon_can_upload) {
        $no_upload = true;
    }
} else {
    if (!$userc->gotpermission('can_upload')) {
        $no_upload = true;
    }
}
if ($no_upload) {
    print "You do not have permission to upload.";
    exit;
}
if (isset($_POST['submit'])) {
    $image = new image();
    $uploaded_image = false;
    $parent = '';
    $error = '';
    if (empty($_FILES['upload']) && isset($_POST['source']) && $_POST['source'] != "" && substr($_POST['source'], 0, 4) == "http" || $_FILES['upload']['error'] != 0 && isset($_POST['source']) && $_POST['source'] != "" && substr($_POST['source'], 0, 4) == "http") {
        $iinfo = $image->getremoteimage($_POST['source']);
        if ($iinfo === false) {
Example #10
0
         $retme = $set->fetch_assoc();
         if ($retme['user'] == "" || $retme['user'] == null) {
             $user = "******";
         } else {
             $user = htmlentities($retme['user'], ENT_QUOTES, 'UTF-8');
         }
         echo '<tr><td></td><td><a href="index.php?page=post&s=view&id=' . $id . '">' . $id . '</a></td><td>' . $row['updated_at'] . '</td><td>' . $user . '</td><td>' . $row['tags'] . '</td><td><a href="#" onclick="if(confirm(\'Do you really want to revert to this point?\')){document.location=\'index.php?page=history&type=revert_tags&id=' . $id . '&version=' . $row['version'] . '\'; return false;}">Revert</a></td></tr>';
     }
     print "</table>";
     $result->free_result();
     if ($count <= 0) {
         echo '<h1>This post has no tag history!</h1>';
     }
 } else {
     if ($type == "revert") {
         if ($userc->gotpermission('reverse_notes')) {
             $pid = $db->real_escape_string($_GET['pid']);
             $version = $db->real_escape_string($_GET['version']);
             $query = "SELECT updated_at, x, y, width, height, body, user_id, ip FROM {$note_history_table} WHERE id='{$id}' AND post_id='{$pid}' AND version='{$version}'";
             $result = $db->query($query);
             $row = $result->fetch_assoc();
             $query = "UPDATE {$note_table} SET updated_at='" . $row['updated_at'] . "', x='" . $row['x'] . "', y='" . $row['y'] . "', width='" . $row['width'] . "', height='" . $row['height'] . "', body='" . $row['body'] . "', user_id='" . $row['user_id'] . "', ip='" . $row['ip'] . "', version='{$version}' WHERE id='{$id}' AND post_id='{$pid}'";
             $result->free_result();
             $db->query($query);
             $query = "DELETE FROM {$note_history_table} WHERE id='{$id}' AND post_id='{$pid}' AND version >= '{$version}'";
             $db->query($query);
             $cache->destroy("cache/" . $id . "/post.cache");
             header("Location:index.php?page=post&s=view&id={$pid}");
         }
         header("Location:index.php?page=post&s=view&id={$pid}");
     } else {
Example #11
0
<?php

$user = new user();
if (!$user->check_log()) {
    exit;
}
if (isset($_GET['pid']) && isset($_GET['cid']) && $_GET['pid'] != "" && $_GET['cid'] != "") {
    $pid = $db->real_escape_string($_GET['pid']);
    $cid = $db->real_escape_string($_GET['cid']);
    $uid = $checked_user_id;
    $uname = $checked_username;
    $query = "SELECT t1.author, t2.creation_post FROM {$forum_post_table} AS t1 JOIN {$forum_topic_table} AS t2 ON t2.id=t1.topic_id WHERE t1.topic_id='{$pid}' AND t1.id='{$cid}' LIMIT 1";
    $result = $db->query($query) or die($db->error);
    $row = $result->fetch_assoc();
    if ($row['author'] == $uname || $user->gotpermission('delete_forum_posts')) {
        //make sure we don't erase the first post of a topic, would cause a huge mess... just edit it, or delete the topic.
        if ($row['creation_post'] != $cid) {
            $query = "DELETE FROM {$forum_post_table} WHERE id='{$cid}'";
            $db->query($query);
        }
    }
    header("Location:index.php?page=forum&s=view&id={$pid}");
    exit;
} else {
    if (isset($_GET['fid']) && is_numeric($_GET['fid']) && isset($_GET['pid']) && is_numeric($_GET['pid'])) {
        if ($user->gotpermission('delete_forum_topics')) {
            $fid = $db->real_escape_string($_GET['fid']);
            $pid = $db->real_escape_string($_GET['pid']);
            $query = "DELETE FROM {$forum_post_table} WHERE topic_id='{$fid}'";
            $db->query($query) or die($db->error);
            $query = "DELETE FROM {$forum_topic_table} WHERE id='{$fid}'";
Example #12
0
<?php

require "../inv.header.php";
$userc = new user();
if (!$userc->gotpermission('is_admin')) {
    header('Location:../');
    exit;
}
if (isset($_POST['password']) && isset($_POST['group']) && is_numeric($_POST['group'])) {
    $user = $db->real_escape_string($_POST['uid']);
    $pass = $db->real_escape_string($_POST['password']);
    $group = $db->real_escape_string($_POST['group']);
    if ($pass != "") {
        $query = "UPDATE {$user_table} SET pass='******', ugroup='{$group}' WHERE user='******'";
    } else {
        $query = "UPDATE {$user_table} SET ugroup='{$group}' WHERE user='******'";
    }
    if ($db->query($query)) {
        print 'User edited.<meta http-equiv="refresh" content="2;url=edit_user.php">';
    } else {
        print 'Could not edit user.<meta http-equiv="refresh" content="2;url=edit_user.php">';
    }
    exit;
} else {
    if (isset($_POST['user']) && $_POST['user'] != "") {
        $user = $db->real_escape_string($_POST['user']);
        echo '<form method="post" action="">
		<table><tr><td>
		User: '******'</td></tr>
		<tr><td>
		New password?<br />