From 3b06ee0d381dc1be5f40ca98ad4278046d869d21 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:57:39 +0100 Subject: checked in initial customized verison for Archlinux32 --- include/common_admin.php | 174 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 include/common_admin.php (limited to 'include/common_admin.php') diff --git a/include/common_admin.php b/include/common_admin.php new file mode 100644 index 0000000..bb6ce50 --- /dev/null +++ b/include/common_admin.php @@ -0,0 +1,174 @@ +read()) !== false) + { + if (!is_dir(PUN_ROOT.'plugins/'.$entry) && preg_match('%^AM?P_(\w+)\.php$%i', $entry)) + { + $prefix = substr($entry, 0, strpos($entry, '_')); + + if ($prefix == 'AMP' || ($is_admin && $prefix == 'AP')) + $plugins[$entry] = substr($entry, strlen($prefix) + 1, -4); + } + } + $d->close(); + + natcasesort($plugins); + + return $plugins; +} + + +// +// Display the admin navigation menu +// +function generate_admin_menu($page = '') +{ + global $pun_config, $pun_user, $lang_admin_common; + + $is_admin = $pun_user['g_id'] == PUN_ADMIN ? true : false; + +?> +
+
+

+
+
+
    + > + > + > + > +
+
+
+ +

+
+
+
    + > + > + > + > + > + > + > +
+
+
+ +

+
+
+ +
+
+ +
+ +query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.$extra_sql, true) or error('Unable to fetch topics', __FILE__, __LINE__, $db->error()); + + $topic_ids = ''; + while ($row = $db->fetch_row($result)) + $topic_ids .= (($topic_ids != '') ? ',' : '').$row[0]; + + if ($topic_ids != '') + { + // Fetch posts to prune + $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topic_ids.')', true) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); + + $post_ids = ''; + while ($row = $db->fetch_row($result)) + $post_ids .= (($post_ids != '') ? ',' : '').$row[0]; + + if ($post_ids != '') + { + // Delete topics + $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $db->error()); + // Delete subscriptions + $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error()); + // Delete posts + $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error()); + + // We removed a bunch of posts, so now we have to update the search index + require_once PUN_ROOT.'include/search_idx.php'; + strip_search_index($post_ids); + } + } +} -- cgit v1.2.3-54-g00ecf