Beta PM system
This commit is contained in:
@@ -127,11 +127,11 @@
|
||||
|
||||
// Delete
|
||||
if($this->mod['type'] >= $config['mod']['delete'])
|
||||
$built .= ' <a title="Delete" href="?/' . $board['uri'] . '/delete/' . $this->id . '">' . $config['mod']['link_delete'] . '</a>';
|
||||
$built .= ' <a onclick="return confirm(\'Are you sure you want to delete this?\')" title="Delete" href="?/' . $board['uri'] . '/delete/' . $this->id . '">' . $config['mod']['link_delete'] . '</a>';
|
||||
|
||||
// Delete all posts by IP
|
||||
if($this->mod['type'] >= $config['mod']['deletebyip'])
|
||||
$built .= ' <a title="Delete all posts by IP" href="?/' . $board['uri'] . '/deletebyip/' . $this->id . '">' . $config['mod']['link_deletebyip'] . '</a>';
|
||||
$built .= ' <a onclick="return confirm(\'Are you sure you want to delete all posts by IP?\')" title="Delete all posts by IP" href="?/' . $board['uri'] . '/deletebyip/' . $this->id . '">' . $config['mod']['link_deletebyip'] . '</a>';
|
||||
|
||||
// Ban
|
||||
if($this->mod['type'] >= $config['mod']['ban'])
|
||||
@@ -274,11 +274,11 @@
|
||||
|
||||
// Delete
|
||||
if($this->mod['type'] >= $config['mod']['delete'])
|
||||
$built .= ' <a title="Delete" href="?/' . $board['uri'] . '/delete/' . $this->id . '">' . $config['mod']['link_delete'] . '</a>';
|
||||
$built .= ' <a onclick="return confirm(\'Are you sure you want to delete this?\')" title="Delete" href="?/' . $board['uri'] . '/delete/' . $this->id . '">' . $config['mod']['link_delete'] . '</a>';
|
||||
|
||||
// Delete all posts by IP
|
||||
if($this->mod['type'] >= $config['mod']['deletebyip'])
|
||||
$built .= ' <a title="Delete all posts by IP" href="?/' . $board['uri'] . '/deletebyip/' . $this->id . '">' . $config['mod']['link_deletebyip'] . '</a>';
|
||||
$built .= ' <a onclick="return confirm(\'Are you sure you want to delete all posts by IP?\')" title="Delete all posts by IP" href="?/' . $board['uri'] . '/deletebyip/' . $this->id . '">' . $config['mod']['link_deletebyip'] . '</a>';
|
||||
|
||||
// Ban
|
||||
if($this->mod['type'] >= $config['mod']['ban'])
|
||||
|
16
inc/mod.php
16
inc/mod.php
@@ -56,6 +56,22 @@
|
||||
unset($_SESSION['mod']);
|
||||
}
|
||||
|
||||
function create_pm_header() {
|
||||
global $mod;
|
||||
$query = prepare("SELECT `id` FROM `pms` WHERE `to` = :id AND `unread` = 1");
|
||||
$query->bindValue(':id', $mod['id'], PDO::PARAM_INT);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
if($pm = $query->fetch()) {
|
||||
return 'You have <a href="?/PM/' . $pm['id'] . '">an unread PM</a>' .
|
||||
($query->rowCount() > 1 ?
|
||||
', plus ' . ($query->rowCount()-1) . ' more waiting'
|
||||
: '') . '.';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function modLog($action) {
|
||||
global $mod;
|
||||
$query = prepare("INSERT INTO `modlogs` VALUES (:id, :ip, :time, :text)");
|
||||
|
@@ -5,10 +5,7 @@
|
||||
// savetheinternet@n0v4.com
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Standard configuration
|
||||
//
|
||||
// Folder where the template files are kept
|
||||
$templateDir = $config['dir']['template'];
|
||||
// Standard configuration
|
||||
//
|
||||
// Enable global things like %gentime, etc.
|
||||
$templateGlobals = true;
|
||||
@@ -170,12 +167,18 @@
|
||||
}
|
||||
|
||||
function Element($templateFile, array $options) {
|
||||
global $templateDir;
|
||||
global $config;
|
||||
|
||||
// Small little hack to add the PM system
|
||||
if(function_exists('create_pm_header') && @$options['mod']) {
|
||||
$options['pm'] = create_pm_header();
|
||||
}
|
||||
|
||||
// Read the template file
|
||||
if($template = @file_get_contents("${templateDir}/${templateFile}")) {
|
||||
if($template = @file_get_contents("{$config['dir']['template']}/${templateFile}")) {
|
||||
return templateParse($template, $options, null, $templateFile);
|
||||
} else {
|
||||
throw new Exception("Template file '${templateFile}' does not exist or is empty in '${templateDir}'!");
|
||||
throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user