Skip to content

Commit

Permalink
Fixed issue 04957 : php alert if rename template
Browse files Browse the repository at this point in the history
Dev : test with isStandardTemplate

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@9787 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Shnoulle committed Feb 15, 2011
1 parent 3ddcc9c commit 8ae8907
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions admin/templates.php
Expand Up @@ -267,18 +267,21 @@
}

if ($action == "templaterename" && isset($newname) && isset($copydir) && (!in_array($newname,$standardtemplates)))
{
$newdirname=$usertemplaterootdir."/".$newname;
$olddirname=$usertemplaterootdir."/".$copydir;
{
if (isStandardTemplate($newname)){
echo "<script type=\"text/javascript\">\n<!--\nalert(\"".sprintf($clang->gT("Template could not be renamed to `%s`.","js"), $newname)." ".$clang->gT("This name is reserved for standard template.","js")."\");\n//-->\n</script>";
}
$newdirname=$usertemplaterootdir."/".$newname;
$olddirname=$usertemplaterootdir."/".$copydir;
if (rename($olddirname, $newdirname)==false) {
echo "<script type=\"text/javascript\">\n<!--\nalert(\"".sprintf($clang->gT("Directory could not be renamed to `%s`.","js"), $newname)." ".$clang->gT("Maybe you don't have permission.","js")."\");\n//-->\n</script>";
}
}
else
{
$templates[$newname]=$newdirname;
{
$templates[$newname]=$newdirname;
$templatename=$newname;
}
}
}

if ($action == "templateuploadfile")
{
Expand Down

0 comments on commit 8ae8907

Please sign in to comment.