From 41f6b25f0f27913ca8ef44a989738cea73c4884e Mon Sep 17 00:00:00 2001 From: Brian Huisman Date: Thu, 27 Apr 2023 13:10:22 -0400 Subject: [PATCH] Allow specifying Default Category --- orcinus/admin.php | 24 ++++++++++++++++++++++++ orcinus/config.php | 2 ++ orcinus/crawler.php | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/orcinus/admin.php b/orcinus/admin.php index 12e9fed..5e849b4 100644 --- a/orcinus/admin.php +++ b/orcinus/admin.php @@ -425,6 +425,14 @@ if (!$_SESSION['admin_username']) { OS_setValue('sp_ignore_ext', substr($_POST['os_sp_ignore_ext'], 0, 4095)); } + if (isset($_POST['os_sp_category_default'])) { + $_POST['os_sp_category_default'] = preg_replace(array('/\s/', '/ {2,}/'), ' ', trim($_POST['os_sp_category_default'])); + $_POST['os_sp_category_default'] = preg_replace('/[^\w \d-]/', '', $_POST['os_sp_category_default']); + if ($_POST['os_sp_category_default']) { + OS_setValue('sp_category_default', substr($_POST['os_sp_category_default'], 0, 30)); + } else $_SESSION['error'][] = 'Category names may only contain letters, numbers, spaces or dashes.'; + } else $_SESSION['error'][] = 'Please supply a category name.'; + if (isset($_POST['os_sp_ignore_css'])) { $_POST['os_sp_ignore_css'] = preg_replace( array('/[^\w\d\. #_:-]/', '/ {2,}/'), @@ -2146,6 +2154,22 @@ document.write(mustache.render( ?> +
  • +

    Categories

    +

    + Usually you'll want all your indexed pages in just one category. In some cases + however, you may want to offer users an additional way to restrict results by + putting groups of pages into multiple categories. You can set page categories + from the Page Index. +

    + +
  • Content Filters

    diff --git a/orcinus/config.php b/orcinus/config.php index d309e54..63e2f24 100644 --- a/orcinus/config.php +++ b/orcinus/config.php @@ -58,6 +58,7 @@ if (!in_array($_DDATA['tbprefix'].'config', $_DDATA['tables'])) { `sp_ignore_css` TEXT NOT NULL, `sp_require_url` TEXT NOT NULL, `sp_title_strip` TEXT NOT NULL, + `sp_category_default` TINYTEXT NOT NULL, `sp_timeout_url` TINYINT UNSIGNED NOT NULL, `sp_timeout_crawl` SMALLINT UNSIGNED NOT NULL, `sp_interval` TINYINT UNSIGNED NOT NULL, @@ -137,6 +138,7 @@ if (!count($testConf->fetchAll())) { `sp_ignore_css`=\'.noindex footer form head nav noscript select style svg textarea\', `sp_require_url`=\'\', `sp_title_strip`=\'\', + `sp_category_default`=\'Main\', `sp_timeout_url`=10, `sp_timeout_crawl`=300, `sp_interval`=24, diff --git a/orcinus/crawler.php b/orcinus/crawler.php index 623b285..f7e05d2 100644 --- a/orcinus/crawler.php +++ b/orcinus/crawler.php @@ -1432,7 +1432,7 @@ while ($_cURL && count($_RDATA['sp_queue'])) { 'title' => $data['title'], 'description' => $data['description'], 'keywords' => $data['keywords'], - 'category' => 'Main', + 'category' => $_ODATA['sp_category_default'], 'weighted' => $data['weighted'], 'links' => json_encode($data['links'], JSON_INVALID_UTF8_IGNORE), 'content' => $data['content'],