Exemplo n.º 1
0
		<?php 
echo $author['styled_name'];
?>
<br />
<?php 
if (is_loaded('titles')) {
    ?>
		<?php 
    echo get_title($author);
    ?>
 - 
<?php 
}
?>
		<?php 
echo forum_count(false, $author['id'], 'user');
?>
 posts
		
<?php 
load_hook('message_user_info_after');
?>
		<div class="clear"></div>
	</div>
	
	<div id="post">
<?php 
load_hook('message_before');
?>
		<?php 
echo parse($post['message']);
Exemplo n.º 2
0
                            </a>
                        </span>
                    </td>
                    <td nowrap="nowrap" align="center" class="item">
                        <?php 
        echo $topic_author['styled_name'];
        ?>
                    </td>
                    <td nowrap="nowrap" align="center" class="item grey">
                        <?php 
        echo $status;
        ?>
                    </td>
                    <td nowrap="nowrap" align="center" class="item grey">
                        <?php 
        echo forum_count(false, $row['id'], '');
        ?>
                    </td>
                    <td nowrap="nowrap" align="center" class="item key">
                        <a href="<?php 
        echo $config['url_path'];
        ?>
/message.php?edit=<?php 
        echo $row['id'];
        ?>
">Edit</a>
                    </td>
                    <td nowrap="nowrap" align="center" class="item key">
                        <a href="<?php 
        echo $config['url_path'];
        ?>
Exemplo n.º 3
0
/**
 * Allows creation of topics, stuck or closed, and posts
 * @global array
 * @global array
 * @global resource
 * @param string $topic post subject
 * @param string $content post content
 * @param integer $reply id of topic we are replying to
 * @param boolean $sticky are we sticking it to the top?
 * @param boolean $closed are we closing it?
 * @return string|int
 */
function post($category, $topic, $content, $reply = false, $sticky = false, $closed = false)
{
    global $config, $user_data, $database;
    // The time. milliseconds / seconds may change.
    $time = time();
    // Its new right now.
    $new = true;
    // Pre-Parse
    $topic = strip_repeat($topic);
    if ($_SESSION['logged_in']) {
        // If we aren't replying don't set up a category.
        if (!$reply) {
            // Check validity of category as numeric
            if (!alpha($category, 'numeric')) {
                return lang('error_invalid_category');
            }
            // Check to see if category exists
            $category = category($category);
            if (!$category) {
                return lang('error_invalid_category');
            }
            // Check category settings
            if ($category['aop'] && $reply) {
                if (!$user_data['admin'] || !$user_data['moderator']) {
                    return lang('error_invalid_category');
                }
            }
            if ($category['aot'] && !$reply) {
                if ($user_data['id'] != $category['aot']) {
                    return lang('error_invalid_category');
                }
            }
        }
        // Topic alpha check. Don't know if I should keep this.
        if (!alpha($topic, 'alpha-extra')) {
            return lang_parse('error_invalid_chars', array(lang('subject')));
        }
        // String length
        if (is_string(length($topic, $config['subject_minimum_length'], $config['subject_max_length']))) {
            return lang_parse('error_subject_length', array($config['subject_max_length'], $config['subject_minimum_length']));
        }
        // Do we have content to go on?
        if ($content != "") {
            if (!is_string(length($content, $config['message_minimum_length'], $config['message_max_length']))) {
                // Are we replying or is it new?
                if ($reply) {
                    if (alpha($reply, 'numeric')) {
                        if (topic($reply, 'id')) {
                            $new = false;
                            // topic data
                            $topic_data = topic($reply, '*');
                            // is it closed?
                            if ($topic_data['closed'] && (!$user_data['admin'] || !$user_data['moderator'])) {
                                return lang('error_topic_closed');
                            }
                            // Setup reply category
                            $category = category($topic_data['category']);
                        } else {
                            return lang('error_topic_missing');
                        }
                    } else {
                        return lang_parse('error_invalid_given', array(lang('topic') . " " . lang('id')));
                    }
                }
                // Sticky
                $sticky = $sticky ? '1' : '0';
                // Closed
                $closed = $closed ? '1' : '0';
                // Time Lapse
                if (!$user_data['admin']) {
                    // Get the time we need to check against
                    if (!$new) {
                        $time_between = time() - $config['post_reply_time_limit'];
                    } else {
                        $time_between = time() - $config['post_topic_time_limit'];
                    }
                    // Last post by this user?
                    $query = "SELECT `time` FROM `forum` WHERE `starter_id` = '{$user_data['id']}' AND `time` > {$time_between}";
                    // Fetch users last post
                    $result = $database->query($query);
                    // is there a result?
                    if ($database->num($result) > 0) {
                        return lang('error_flood_detection');
                    }
                }
                // So we don't have leftovers.
                unset($query, $result);
                // Guess we can go ahead and add you~
                $query = "INSERT INTO `forum` (`category`,`subject`,`message`,`reply`,`starter_id`,`host`,`time`,`updated`,`sticky`,`closed`) VALUES (%d,'%s','%s',%d,%d,'%s','%s','%s','%s','%s')";
                $query = sprintf($query, $category['id'], $database->escape($topic), $database->escape($content), $new ? 0 : $reply, $user_data['id'], $database->escape(gethostname()), $time, $time, $sticky, $closed);
                // Insert into mysql and retrieve id.
                $result = $database->query($query);
                if ($result) {
                    // the id from the previous query
                    $id = $database->insert_id();
                    // users new post count
                    $new_post_count = $user_data['posts'] + 1;
                    // update user post count
                    update_user($user_data['id'], false, 'posts', $new_post_count);
                    // Start sending back information
                    if ($new) {
                        return $id;
                    } else {
                        // How many replies?
                        $replies = intval(forum_count(false, $reply, false));
                        // Lets update it
                        $replies = $replies + 1;
                        // Woooo~ Last id for redirecting~
                        if ($config['show_first_post']) {
                            $page_numbers = ($replies - 1) / $config['messages_per_topic'] - 1;
                        } else {
                            $page_numbers = $replies / $config['messages_per_topic'] - 1;
                        }
                        $n = ceil($page_numbers);
                        // A little fixing
                        if ($n == -1) {
                            $n = 0;
                        } else {
                            $n = abs($n);
                        }
                        // Update
                        $query = "UPDATE `forum` SET `updated`='{$time}', `replies`='{$replies}' WHERE id = '{$reply}'";
                        // Update
                        $result = $database->query($query);
                        // Return last page number and id for redirect.
                        return array('page' => $n, 'id' => $id);
                    }
                } else {
                    return lang('error_unknown');
                }
            } else {
                return lang_parse('error_message_length', array($config['message_max_length'], $config['message_minimum_length']));
            }
        } else {
            return lang_parse('error_no_given', array(lang('message')));
        }
    } else {
        return lang('error_not_logged');
    }
}
Exemplo n.º 4
0
                $start_on = 1;
            } else {
                $start_on = 0;
            }
            // Check the numbers to fetch.
            if (isset($start)) {
                if (is_numeric($start)) {
                    $posts = fetch(false, false, intval($_GET['id']), 'time', 'ASC', $start, $config['messages_per_topic']);
                } else {
                    $posts = fetch(false, false, intval($_GET['id']), 'reply`, `timestamp', 'ASC', $start_on, $config['messages_per_topic']);
                }
            } else {
                $posts = fetch(false, false, intval($_GET['id']), 'reply`, `time', 'ASC', $start_on, $config['messages_per_topic']);
            }
            // Number of pages
            $pagination = generate_pagination($topic_url, forum_count(false, $topic['id'], ''), $config['messages_per_topic'], $start);
        } else {
            print_out(lang('error_topic_missing'), lang('redirecting'));
        }
    } else {
        if (!is_numeric($id)) {
            print_out(lang_parse('error_given_not_numeric', array(lang('id_c'))), lang('redirecting'));
        }
    }
} else {
    print_out(lang_parse('error_invalid_given', array(lang('id'))), lang('redirecting'));
}
// Lets tell navigation we are viewing a topic
$in_topic = true;
/**
 * Include navigation template
Exemplo n.º 5
0
         $page = 0;
     }
     // Start point
     $start = $page * $config['messages_per_page'];
     // Check the numbers to fetch.
     if (isset($start)) {
         if (is_numeric($start)) {
             $posts = fetch_all(true, intval($start), $config['messages_per_page']);
         } else {
             $posts = fetch_all(true, 0, $config['messages_per_page']);
         }
     } else {
         $posts = fetch_all(true, 0, $config['messages_per_page']);
     }
     // Topic count
     $post_count = forum_count(false, false, 'posts');
     // Messages per page
     $post_pagination = generate_pagination($config['url_path'] . '/admin.php?a=posts', $post_count, $config['messages_per_page'], $start);
 }
 /**
  * Include header
  */
 include $config['template_path'] . "header.php";
 /**
  * Include navigation
  */
 include $config['template_path'] . "navigation.php";
 /**
  * Include admin navigation
  */
 include $config['template_path'] . "admin/navigation.php";
Exemplo n.º 6
0
						<div class="post">
							<?php 
echo lang('joined');
?>
: <?php 
echo date($config['date_format'], $viewing['join_date']);
?>
						</div>
						<div class="post">
							<?php 
echo lang('last_visit');
?>
: <?php 
echo date($config['date_format'], $viewing['last_seen']);
?>
						</div>
						<div class="post">
							<?php 
echo lang('total_posts');
?>
: <?php 
echo forum_count(false, $viewing['id']);
?>
						</div>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
Exemplo n.º 7
0
					<td align="center" class="item grey"><?php 
        if ($user['admin']) {
            echo lang('admin') . ' ';
        } else {
            if ($user['moderator']) {
                echo 'Moderator ';
            } else {
                if ($user['banned']) {
                    echo lang('banned') . ' ';
                }
            }
        }
        ?>
</td>
					<td align="center" class="item grey"><?php 
        echo forum_count(false, $user['id']);
        ?>
</td>
					<td align="center" class="item key"><a href="<?php 
        echo $config['url_path'];
        ?>
/admin.php?a=users&edit=<?php 
        echo $user['id'];
        ?>
"><?php 
        echo lang('edit');
        ?>
</a></td>
<?php 
        if ($user['banned']) {
            ?>
Exemplo n.º 8
0
echo forum_count(false, false, 'posts');
?>
<br />
					<?php 
echo forum_count(false, false, 'posts', true);
?>
				</dd>
			</dl>
	
			<dl class="input">
				<dt><?php 
echo lang('total_topics_posts');
?>
</dt>
				<dd><?php 
echo forum_count(false, false, 'all');
?>
</dd>
			</dl>
		</div>
			
		<h3 class="title admin"><?php 
echo lang('user_registrations');
?>
</h3>
		
		<div class="content">
			<dl class="input">
				<dt>
					<?php 
echo lang('user_registrations');
Exemplo n.º 9
0
            if ($category['expanded']) {
                continue;
            }
            ?>
		<tr>
			<td class="subject"><a href="?category=<?php 
            echo $category['id'];
            ?>
"><?php 
            echo $category['name'];
            ?>
</a></td>
			<td class="posts"><?php 
            $posts = forum_count($category['id'], false, 'posts');
            echo (int) $posts;
            ?>
</td>
			<td class="posts"><?php 
            $posts = forum_count($category['id'], false, 'all', false, true);
            echo (int) $posts;
            ?>
</td>
		</tr>
<?php 
        }
        ?>
	</table>
</div>
<?php 
    }
}
Exemplo n.º 10
0
        }
    }
}
/**
 * End index
 */
include $config['template_path'] . "forum/index-close.php";
// The online data for all users
$online_data = users_online();
// Guest Counter Plugin
if (is_loaded('guest_counter')) {
    // The online data for guests
    $guests_online_data = guests_online();
    // The online data for bots
    $bots_online_data = guests_online(false, true);
}
// The online data for admins
$admin_online_data = users_online(true);
// Total users
$user_count = count_users();
// Forum counts
$topic_count = forum_count(false, '*', false);
$post_count = forum_count(false, false, 'all');
/**
 * Include forum details template
 */
include $config['template_path'] . "forum/details.php";
/**
 * Include footer template
 */
include $config['template_path'] . "footer.php";
Exemplo n.º 11
0
         $page = 0;
     }
     // Start point
     $start = $page * $config['messages_per_page'];
     // Check the numbers to fetch.
     if (isset($start)) {
         if (is_numeric($start)) {
             $posts = fetch_all(true, intval($start), $config['messages_per_page']);
         } else {
             $posts = fetch_all(true, 0, $config['messages_per_page']);
         }
     } else {
         $posts = fetch_all(true, 0, $config['messages_per_page']);
     }
     // Topic count
     $post_count = forum_count(false, false, false, false, true);
     // Messages per page
     $post_pagination = generate_pagination($config['url_path'] . '/admin.php?a=posts', $post_count, $config['messages_per_page'], $start);
 }
 /**
  * Include header
  */
 include $config['template_path'] . "header.php";
 /**
  * Include navigation
  */
 include $config['template_path'] . "navigation.php";
 /**
  * Include admin navigation
  */
 include $config['template_path'] . "admin/navigation.php";
Exemplo n.º 12
0
/**
 * Allows updating of topics, stuck or closed, and posts
 * @global array
 * @global array
 * @global resource
 * @param integer $id post we are editing
 * @param string $topic post subject
 * @param string $content post content
 * @param integer $reply id of topic we are replying to
 * @param boolean $sticky are we sticking it to the top?
 * @param boolean $closed are we closing it?
 * @return string|int
 */
function update($id, $category, $topic, $content, $sticky = false, $closed = false)
{
    global $config, $user_data, $database;
    // The time. milliseconds / seconds may change.
    $time = time();
    // Is the id numeric?
    if (!alpha($id, 'numeric')) {
        return lang_parse('error_given_not_numeric', array(lang('post') . " " . lang('id')));
    }
    // Grab the data for the update.
    $post_data = topic($id);
    // Check to see if the post or topic was found.
    if (!$post_data) {
        return lang('error_post_missing');
    }
    // Pre-Parse
    $topic = strip_repeat($topic);
    // Can't update a replies category!
    if ($post_data['reply']) {
        $category = $post_data['category'];
    }
    // Check validity of category as numeric
    if (!alpha($category, 'numeric')) {
        return lang('error_invalid_category');
    }
    // Check to see if category exists
    $category = category($category);
    if (!$category) {
        return lang('error_invalid_category');
    }
    // Check category settings against user
    if (!$user_data['admin']) {
        if ($category['aop'] && $post_data['reply']) {
            if (!$user_data['admin'] || !$user_data['moderator']) {
                return lang('error_invalid_category');
            }
        }
        if ($category['aot'] && !$post_data['reply']) {
            if ($user_data['id'] != $category['aot']) {
                return lang('error_invalid_category');
            }
        }
    }
    // Is the user currently logged in? If not we can't update return error.
    if ($_SESSION['logged_in']) {
        // Editing a topic not post
        if ($post_data['reply'] == 0) {
            // Is there a topic?
            if ($topic == "") {
                return lang_parse('error_no_given', array(lang('username')));
            }
        } else {
            // If there was no topic put re: on it.
            if ($topic == "") {
                $topic = "re:";
            }
        }
        // Did they give us any content to work with?
        if ($content != "") {
            if (!is_string(length($content, $config['message_minimum_length'], $config['message_max_length']))) {
                // Check to see if the user is an admin and able to sticky / close the topic
                if ($_SESSION['admin'] || $_SESSION['moderator']) {
                    // Sticky
                    $sticky = $sticky ? '1' : '0';
                    // Closed
                    $closed = $closed ? '1' : '0';
                    // Admin functions
                    update_field($id, 'sticky', $sticky);
                    update_field($id, 'closed', $closed);
                }
                // Parsing
                $topic = $database->escape($topic);
                $content = $database->escape($content);
                // Update the post already inside of the database with the new data
                $result = $database->query("UPDATE `forum` SET `category`='{$category['id']}', `subject`='{$topic}', `message`='{$content}', `updated`='{$time}', `replies`='{$replies}' WHERE id = '{$id}'") or die(mysql_error());
                // Did it work?
                if ($result) {
                    // Update replies with category
                    if ($category != $post_data['category'] && !$post_data['reply']) {
                        $database->query("UPDATE `forum` SET `category`='{$category['id']}' WHERE `reply` = {$id}");
                    }
                    if ($post_data['reply'] != 0) {
                        // How many replies?
                        $replies = intval(forum_count(false, $post_data['reply'], false));
                        // Woooo~ Last id for redirecting~
                        if ($config['show_first_post']) {
                            $page_numbers = ($replies - 1) / $config['messages_per_topic'] - 1;
                        } else {
                            $page_numbers = $replies / $config['messages_per_topic'] - 1;
                        }
                        $n = ceil($page_numbers);
                        // A little fixing
                        if ($n == -1) {
                            $n = 0;
                        } else {
                            $n = abs($n);
                        }
                        // Return last page number and id for redirect.
                        return array('page' => $n, 'id' => $post_data['id']);
                    }
                    return true;
                } else {
                    return false;
                }
            } else {
                return lang_parse('error_message_length', array($config['message_max_length'], $config['message_minimum_length']));
            }
        } else {
            return lang_parse('error_no_given', array(lang('message')));
        }
    } else {
        return lang('error_not_logged');
    }
}
Exemplo n.º 13
0
					<span class="date"><?php 
            echo date($config['date_format'], $post['time'] + $config['zone']);
            ?>
</span>
                </dt>
                <dd>Administrator</dd>
<?php 
        }
    }
}
?>
				<?php 
load_hook('message_user_info_after');
?>
                <dd><?php 
echo forum_count(false, $author['id']);
?>
 posts</dd>
                <dd><?php 
echo lang('joined');
?>
 <?php 
echo date($config['date_format'], $author['join_date']);
?>
</dd>
				<?php 
load_hook('message_user_info_after');
?>
            </dl>
        </td>
		<td align="right" valign="top">
Exemplo n.º 14
0
		</div>
		
		<div class="content">
			<dl class="input">
				<dt>
					<?php 
echo lang('total_posts');
?>
<br />
					<span><?php 
echo lang('total_posts_msg');
?>
</span>
				</dt>
				<dd><?php 
echo forum_count(false, $user_data['id'], 'user');
?>
</dd>
			</dl>
		</div>
		
		<div class="content">
			<dl class="input">
				<dt>
					<?php 
echo lang('last_post');
?>
<br />
					<span><?php 
echo lang('last_post_msg');
?>
Exemplo n.º 15
0
        if (empty($forum)) {
            $arr['fid'] = $fid;
            $r = forum_create($arr);
            $r !== FALSE ? message(0, '创建成功') : message(11, '创建失败');
        }
        $r = forum_update($fid, $arr);
        $r !== FALSE ? message(0, '更新成功') : message(12, '更新失败');
    }
} elseif ($action == 'delete') {
    if ($method != 'POST') {
        message(-1, 'Method Error.');
    }
    $fid = param(2, 0);
    $forum = forum_read($fid);
    empty($forum) and message(1, '板块不存在');
    forum_count() == 1 and message(-1, '不能删除最后一个版块。');
    $r = forum_delete($fid);
    $r !== FALSE ? message(0, '删除成功') : message(1, '删除失败');
} elseif ($action == 'uploadicon') {
    $method != 'POST' and message(-1, 'Method Error.');
    $fid = param(2, 0);
    $forum = forum_read($fid);
    empty($forum) and message(1, '板块不存在');
    $upfile = param('upfile', '', FALSE);
    empty($upfile) and message(-1, 'upfile 数据为空');
    $json = xn_json_decode($upfile);
    empty($json) and message(-1, '数据有问题: json 为空');
    $name = $json['name'];
    $width = $json['width'];
    $height = $json['height'];
    $data = base64_decode($json['data']);
Exemplo n.º 16
0
?>
</a></span>
		</td>
		<td align="right" class="creator">
			<?php 
echo lang('created_on');
?>
 <?php 
echo date($config['date_format'], $row['time'] + $config['zone']);
?>
		</td>
	</tr>
	<tr>
		<td class="details" colspan="2"> 
			<span class="item"><?php 
echo forum_count($row['id']);
?>
 Posts</span>
			<span class="item"><?php 
echo lang('topic_by');
?>
 <strong><?php 
echo $topic_author['styled_name'];
?>
</strong></span>
			<span class="item">
<?php 
if ($last_post) {
    ?>
				Last post was <?php 
    echo nice_date($last_post['time']);
Exemplo n.º 17
0
                            <dd><?php 
echo forum_count(false, false, false, false, true, true);
?>
</dd>
                        </dl>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        <dl class="input">
                            <dt><?php 
echo lang('total_topics_posts');
?>
</dt>
                            <dd><?php 
echo forum_count(false, false, true);
?>
</dd>
                        </dl>
                    </td>
                </tr>
                <tr>
                    <td class="form">
                        <dl class="input">
                            <dt>
                                <?php 
echo lang('user_registrations');
?>
<br />
                                <span><?php 
echo lang('today');