Archived
No categories with the same name
This commit is contained in:
@@ -15,8 +15,12 @@ $data = array();
|
||||
/* Add a new category */
|
||||
if (isset($_POST['SAVE']) && serendipity_checkFormToken()) {
|
||||
$name = $serendipity['POST']['cat']['name'];
|
||||
$desc = $serendipity['POST']['cat']['description'];
|
||||
$data['post_save'] = true;
|
||||
$r = serendipity_db_query("SELECT category_name FROM {$serendipity['dbPrefix']}category WHERE category_name = '". serendipity_db_escape_string($name)."'");
|
||||
if (is_array($r) && is_array($r[0])) {
|
||||
$data['error_name'] = true;
|
||||
} else {
|
||||
$desc = $serendipity['POST']['cat']['description'];
|
||||
if (is_array($serendipity['POST']['cat']['write_authors']) && in_array(0, $serendipity['POST']['cat']['write_authors'])) {
|
||||
$authorid = 0;
|
||||
} else {
|
||||
@@ -60,6 +64,7 @@ if (isset($_POST['SAVE']) && serendipity_checkFormToken()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
serendipity_rebuildCategoryTree();
|
||||
$serendipity['GET']['adminAction'] = 'view';
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{if $error_name}
|
||||
<span class="msg_error"><span class="icon-attention-circled"></span> Could not create category: Name already in use</span> {* i18n *}
|
||||
{/if}
|
||||
{/if}
|
||||
{if $doDelete}
|
||||
{if $deleteSuccess}
|
||||
@@ -181,7 +184,7 @@
|
||||
|
||||
<ul class="plainList clearfix edit_actions">
|
||||
<li><a class="button_link" href="?serendipity[adminModule]=category&serendipity[adminAction]=edit&serendipity[cid]={$category.categoryid}" title="{$CONST.EDIT} {$category.category_name|escape:"html"}"><span class="icon-edit"></span><span class="visuallyhidden"> {$CONST.EDIT}</span></a></li>
|
||||
<li><a class="button_link" href="?serendipity[adminModule]=category&serendipity[adminAction]=newSub&serendipity[cid]={$category.categoryid}" title="{$CONST.SUBCATEGORY_NEW} {$category.category_name|escape:"html"}"><span class="icon-folder-open"></span><span class="visuallyhidden"> {$CONST.SUBCATEGORY_NEW}</span></a></li>
|
||||
<li><a class="button_link" href="?serendipity[adminModule]=category&serendipity[adminAction]=newSub&serendipity[cid]={$category.categoryid}" title="Create Subcategory"><span class="icon-folder-open"></span><span class="visuallyhidden"> Create Subcategory</span></a></li> {* i18n *}
|
||||
<li><a class="button_link" href="?serendipity[adminModule]=category&serendipity[adminAction]=delete&serendipity[cid]={$category.categoryid}" title="{$CONST.DELETE} {$category.category_name|escape:"html"}"><span class="icon-trash"></span><span class="visuallyhidden"> {$CONST.DELETE}</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user