Allow specifying Default Category
This commit is contained in:
parent
619e5b7f11
commit
41f6b25f0f
|
@ -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(
|
|||
?></textarea>
|
||||
</label>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h4 aria-labelledby="os_sp_category_text">Categories</h4>
|
||||
<p id="os_sp_category_text" class="form-text">
|
||||
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 <em>Page Index</em>.
|
||||
</p>
|
||||
<label class="d-flex lh-lg w-100 mb-2">
|
||||
<strong class="pe-2">Default Category:</strong>
|
||||
<span class="flex-grow-1 text-end">
|
||||
<input type="text" name="os_sp_category_default" value="<?php echo $_ODATA['sp_category_default']; ?>" maxlength="30" class="form-control d-inline-block w-auto mw-10em"
|
||||
data-bs-toggle="tooltip" data-bs-placement="bottom" title="Default Category value to apply to newly found pages.">
|
||||
</span>
|
||||
</label>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<h4>Content Filters</h4>
|
||||
<div class="row">
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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'],
|
||||
|
|
Loading…
Reference in a new issue