|
Syntax for: PHP_CSL_6 . Snips_Edit |
<?
if(isset($_POST['snips_edit_form'])) {
// delete the original snippet first
if(file_delete($_POST['cats'],$_POST['old_snip'])) {
$ob = new SNIPS;
if($ob->snips_create($_POST['cats'], $_POST['title'], $_POST['syntax'], $_POST['description'])) {
$reg = new regex;
$reg->set_string($_POST['title']);
$title = $reg->get_string();
echo '</br><div align=center><b>Snippet Edited !!</b></br>';
echo '<a href=index.php?cat_select='.$_POST['cats'].'&show='.$title.'>click here to refresh and see changes.</a></br></div>';
echo '<script language=javascript>
alert("Snippet Edited");
document.location="index.php?cat_select='.$_POST['cats'].'&show='.$title.'";
</script>';
} else {
echo 'some type of error happend, probably that a snippet with that name already exists</br>';
}
}
} else {
// open the selected snippet
$file_s = $_GET['cats'].".".$_GET['snip'].$snippet_ext_s;
$file_d = $_GET['cats'].".".$_GET['snip'].$snippet_ext_d;
$syntax = file_open($file_s);
$description = file_open($file_d);
echo '</br><form action='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' method=post>';
echo '<table align=center class=table1 cellpadding=6><tr class=rowpic><td colspan=2>Edit a snippet</td></tr><tr><td>';
echo 'Edit title:</td><td align=right><input type=text maxlength=20 size=20 name=title value='.$_GET['snip'].'></td></tr><tr><td colspan=2>';
echo 'Edit Syntax below:</br><textarea name=syntax rows=10 cols=50>'.stripslashes($syntax).'</textarea></td></tr><tr><td colspan=2>';
echo 'Edit Description below:</br><textarea name=description rows=6 cols=50>'.stripslashes($description).'</textarea></td></tr><tr align=center><td colspan=2>';
echo '<input type=hidden name=cats value='.$_GET['cats'].'>';
echo '<input type=hidden name=old_snip value='.$_GET['snip'].'>';
echo '<input type=button class=submit name=cancel OnClick="document.location=\''.$_SERVER['HTTP_REFERER'].'\'" value=Cancel> ';
echo '<input type=submit class=submit name=snips_edit_form value=Edit>';
echo '</td></tr></table></form>';
}
?>
|
Description for: PHP_CSL_6 . Snips_Edit |
|
|