NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 11-24-2012 01:21:12

rainbow
Member

Cannot delete templates

Hello.

I'm having a bit of a problem trying to delete templates and it has to do to some form of a bug that prevents the templates from being deleted properly.

I created a Test template to make sure that I had the ability to create, edit and remove templates. Here's the problem. When I selected a Test template to delete, I go down to the Delete sub-category in the Template designer, use the drop down box to select the Test template and click on Delete. When that's done, I get taken to template deletion confirmation message:

Are you sure you want to delete the template ""?

NO, return to the template editor.

If I select now, I get taken back to the Template Editor. If I select Delete the template doesn't get deleted, because for some reason the Template Editor fails to find a file that is the target for unlinking. Hence it displays a blank file in quotes.

Here's the source code of lines 27 to 61 of tdesign.php to see what it looks like so far:

Code:

if ($action == 'deletetemplate') {
    $my_template = w_gpc('mytemplate');
?>

<form name="formSerious" method="post" action="tdesign.php">
    <p align="center">
        <font size="-1">
            Are you sure you want to delete the template &ldquo;<?php echo $my_template;?>&rdquo;?
        </font>
    </p>

    <p align="center">
        <font size="-1">
            <a href="tdesign.php">NO, return to the Template Editor.</a>
        </font>
    </p>
    <p align="center">
        <input name="mysubmit" value="<?php echo $langop_word_delete;?>" type="submit" class="submit" />
        <input name="action" value="deletetemplateconfirm" type="hidden" />
        <input name="mytemplate" value="<?php echo $my_template;?>" type="hidden" />
    </p>
    <br />
</form>

<?php include ('footer.php');
    exit();
    }

    if ($action == 'delete_template_confirm') {
        $my_template = w_gpc('my_template');
    if (file_exists ('templates/'.$my_template.'.php')) {
        @unlink ('templates/'.$my_template.'.php');
    }
    }
?>

Is there a way to fix this issue so that the Template Editor will be able to recongise the file and unlink (delete) it from the server?

Offline

#2 11-24-2012 05:55:35

Waccoon
Administrator

Re: Cannot delete templates

I'm not sure why you decided to strip all underscores from form input when you made your mod.  Make sure that any reference to the "$mode" and "$action" variables are updated so they no longer contain underscores.

This code in the form has been changed:

Code:

<input name="action" value="deletetemplateconfirm" type="hidden" />

...but you forgot to update this:

Code:

if ($action == 'delete_template_confirm') {

Offline

#3 11-24-2012 13:47:34

rainbow
Member

Re: Cannot delete templates

Waccoon wrote:

I'm not sure why you decided to strip all underscores from form input when you made your mod.  Make sure that any reference to the "$mode" and "$action" variables are updated so they no longer contain underscores.

This code in the form has been changed:

Code:

<input name="action" value="deletetemplateconfirm" type="hidden" />

...but you forgot to update this:

Code:

if ($action == 'delete_template_confirm') {

Thank you for the help.

I had to remove the underscore in my_template and change it to "mytemplate" in order for it to work. When I uploaded the fixed one, I get this message:

Are you sure you want to delete the template "Test"?

When I hit delete, the Test template gets unlinked from the server. smile

Offline

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB