Skip to content

Commit

Permalink
Fixed issue #4957 : php alert in template editor
Browse files Browse the repository at this point in the history
Dev : best test ....

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

if ($action == "templaterename" && isset($newname) && isset($copydir) && (!in_array($newname,$standardtemplates)))
if ($action == "templaterename" && isset($newname) && isset($copydir))
{
$newdirname=$usertemplaterootdir."/".$newname;
$olddirname=$usertemplaterootdir."/".$copydir;
if(isStandardTemplate($newname))
{
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) {
elseif (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;
$templatename=$newname;
}
}
}

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

0 comments on commit e86b9f1

Please sign in to comment.