From cf931325e2cd556662a3cc8b32f59210b07e24f1 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 27 Jun 2012 06:42:06 +0000 Subject: [PATCH] Require font to be a directory (fix problem introduced by webctrl.ini) --- web/root/ecWeb/lib/captchaLib.ssjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/root/ecWeb/lib/captchaLib.ssjs b/web/root/ecWeb/lib/captchaLib.ssjs index a0f9b41a35..1c19b3a324 100644 --- a/web/root/ecWeb/lib/captchaLib.ssjs +++ b/web/root/ecWeb/lib/captchaLib.ssjs @@ -15,7 +15,12 @@ function insertCaptcha() { var d = directory(webIni.webRoot + "/lib/captchaAnsis/*"); - var randomFont = Math.floor(Math.random() * (d.length)); + var randomFont; + while(randomFont==undefined) { + randomFont = Math.floor(Math.random() * (d.length)); + if(!file_isdir(d[randomFont])) + randomFont=undefined; + } while(d[randomFont].match(/CVS/) != null) randomFont = Math.floor(Math.random() * (d.length)); var f = directory(d[randomFont] + "*.a??"); // We're looking for .asc and .ans files. var captchaString = ""; -- GitLab