$page['body'] .= '<divclass="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to update the database.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul></div>';
if (!empty($file_errors))
$page['body'] .= '<divclass="ban"><h2>File System errors</h2><p>File System errors were encountered when trying to create folders.</p><p>The errors encountered were:</p><ul>' . $file_errors . '</ul></div>';
break;
}
echo Element('page.html', $page);
?>
<!-- There is probably a much better way to do this, but eh. -->
$query = prepare(sprintf("DELETE FROM ``archive_%s`` WHERE `lifetime` <:lifetimeAND`featured`=0",$board['uri']))orerror(db_error());
$query = prepare(sprintf("DELETE FROM ``archive_%s`` WHERE `lifetime` <:lifetimeAND`featured`=0AND`mod_archived`=0",$board['uri']))orerror(db_error());
query(sprintf("DELETE FROM ``archive_%s`` WHERE `id` = %d", $board['uri'], (int)$thread_id)) or error(db_error());
query(sprintf("DELETE FROM ``archive_%s`` WHERE `id` = %d AND " . ($mod_archive?"`featured`":"`mod_archived`") . " = 0", $board['uri'], (int)$thread_id)) or error(db_error());
else
else
query(sprintf("UPDATE ``archive_%s`` SET `featured` = 0 WHERE `id` = %d", $board['uri'], (int)$thread_id)) or error(db_error());
query(sprintf("UPDATE ``archive_%s`` SET " . ($mod_archive?"`mod_archived`":"`featured`") . " = 0 WHERE `id` = %d", $board['uri'], (int)$thread_id)) or error(db_error());
// Add mod log entry
modLog(sprintf("Deleted thread #%d from " . ($mod_archive?"mod archive":"featured threads"), $thread_id));
// Rebuild Featured Index
// Rebuild Featured Index
self::buildFeaturedIndex();
self::buildFeaturedIndex();
}
}
@ -274,15 +284,18 @@ class Archive {
static public function getArchiveList($featured = false) {
static public function getArchiveList($featured = false, $mod_archive = false) {
global $config, $board;
global $config, $board;
$archive = false;
$archive = false;
if($featured) {
if($featured) {
$query = query(sprintf("SELECT `id`, `snippet`, `featured` FROM ``archive_%s`` WHERE `featured` = 1 ORDER BY `lifetime` DESC", $board['uri'])) or error(db_error());
$query = query(sprintf("SELECT `id`, `snippet`, `featured`, `mod_archived` FROM ``archive_%s`` WHERE `featured` = 1 ORDER BY `lifetime` DESC", $board['uri'])) or error(db_error());
$archive = $query->fetchAll(PDO::FETCH_ASSOC);
} else if($mod_archive) {
$query = query(sprintf("SELECT `id`, `snippet`, `featured`, `mod_archived` FROM ``archive_%s`` WHERE `mod_archived` = 1 ORDER BY `lifetime` DESC", $board['uri'])) or error(db_error());
$archive = $query->fetchAll(PDO::FETCH_ASSOC);
$archive = $query->fetchAll(PDO::FETCH_ASSOC);
} else {
} else {
$query = prepare(sprintf("SELECT `id`, `snippet`, `featured` FROM ``archive_%s`` WHERE `lifetime` > :lifetime ORDER BY `lifetime` DESC", $board['uri']));
$query = prepare(sprintf("SELECT `id`, `snippet`, `featured`, `mod_archived` FROM ``archive_%s`` WHERE `lifetime` > :lifetime ORDER BY `lifetime` DESC", $board['uri']));
// Directory for "Featured Threads" (threads makred for permanent storage)
// Directory for "Featured Threads" (threads makred for permanent storage)
$config['dir']['featured'] = 'featured/';
$config['dir']['featured'] = 'featured/';
// Directory for "Featured Threads" (threads makred for permanent storage)
$config['dir']['mod_archive'] = 'mod_archive/';
// For load balancing, having a seperate server (and domain/subdomain) for serving static content is
// For load balancing, having a seperate server (and domain/subdomain) for serving static content is
@ -1377,6 +1379,9 @@
// Indicate if link to featured archive should be shown on post and thread page
// Indicate if link to featured archive should be shown on post and thread page
$config['feature']['link_post_page'] = false;
$config['feature']['link_post_page'] = false;
// Indicate if it is possible to mark threads as nostalgic (stored forever but will only be accessable to mods)
$config['mod_archive']['threads'] = true;
// Days to keep archived threads before deletion (ex. "60 minutes", "6 hours", "1 day", "1 week"), if set to false all archived threads are kept forever
// Days to keep archived threads before deletion (ex. "60 minutes", "6 hours", "1 day", "1 week"), if set to false all archived threads are kept forever
$query = query(sprintf("SELECT `id`, `snippet` FROM ``archive_%s`` WHERE `mod_archived` = 1 ORDER BY `lifetime` DESC", $board['uri'])) or error(db_error());
<ahref="#"onclick="return confirm('Are you sure you want to permanently delete this thread from featured archive?')?this.parentNode.submit():false;">[{% trans 'Delete' %}]</a>
<inputtype="hidden"name="delete"value="1">
</form>
<ahref="#"onclick="return confirm('Are you sure you want to permanently delete this thread from featured archive?')?this.parentNode.submit():false;">[{% trans 'Delete' %}]</a>
</td>
</form>
</td>
{% endif %}
{% else %}
{% if mod and mod|hasPermission(config.mod.delete_featured_archived_threads, board.uri) %}
<ahref="#"onclick="return confirm('Are you sure you want to permanently delete this thread from featured archive?')?this.parentNode.submit():false;">[{% trans 'Delete' %}]</a>
{% if config.mod_archive.threads and mod and mod|hasPermission(config.view_mod_archive) %}
<pstyle="text-align: center">
<aid="unimportant"href="{% if mod %}{{ config.file_mod }}?{% endif %}{{ config.root }}{{ board.dir }}{{ config.dir.mod_archive }}">[{% trans %}View Mod Archive{% endtrans %}]</a>
</p>
{% endif %}
{% if config.feature.threads %}
{% if config.feature.threads %}
<pstyle="text-align: center">
<pstyle="text-align: center">
<aid="unimportant"href="{{ config.root }}{% if mod %}{{ config.file_mod }}?/{% endif %}{{ board.dir }}{{ config.dir.featured }}">[{% trans %}Featured Thread Archive{% endtrans %}]</a>
<aid="unimportant"href="{{ config.root }}{% if mod %}{{ config.file_mod }}?/{% endif %}{{ board.dir }}{{ config.dir.featured }}">[{% trans %}Featured Thread Archive{% endtrans %}]</a>
@ -19,6 +24,9 @@
{% if mod and mod|hasPermission(config.mod.feature_archived_threads, board.uri) %}
{% if mod and mod|hasPermission(config.mod.feature_archived_threads, board.uri) %}
<thwidth='80px'> </th>
<thwidth='80px'> </th>
{% endif %}
{% endif %}
{% if mod and mod|hasPermission(config.mod.add_to_mod_archive, board.uri) %}
<thwidth='80px'> </th>
{% endif %}
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
@ -41,6 +49,20 @@
{% endif %}
{% endif %}
</td>
</td>
{% endif %}
{% endif %}
{% if mod and mod|hasPermission(config.mod.add_to_mod_archive, board.uri) %}