[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1271] Regexp logic fixes.
From: |
Toby Inkster |
Subject: |
[Librefm-commits] [1271] Regexp logic fixes. |
Date: |
Thu, 07 May 2009 09:59:14 +0000 |
Revision: 1271
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1271
Author: tobyink
Date: 2009-05-07 09:59:13 +0000 (Thu, 07 May 2009)
Log Message:
-----------
Regexp logic fixes.
Modified Paths:
--------------
trunk/nixtape/data/Group.php
Modified: trunk/nixtape/data/Group.php
===================================================================
--- trunk/nixtape/data/Group.php 2009-05-07 09:53:12 UTC (rev 1270)
+++ trunk/nixtape/data/Group.php 2009-05-07 09:59:13 UTC (rev 1271)
@@ -91,20 +91,15 @@
{
global $mdb2;
- if (!preg_match('/^[^A-Za-z0-9_\.-]{2,}$/', $name))
+ if (!preg_match('/^[A-Za-z0-9][A-Za-z0-9_\.-]+$/', $name))
{
- return (new PEAR_Error('Group names should only contain
letters, numbers, hyphens, underscores and full stops (a.k.a. dots/periods),
and must be at least two characters long.'));
+ return (new PEAR_Error('Group names should only contain
letters, numbers, hyphens, underscores and full stops (a.k.a. dots/periods),
must be at least two characters long, and can\'t start with punctuation.'));
}
- if (!preg_match('/[A-Za-z0-9]/', $name))
+ if (in_array(strtolower($name), array('new', 'search')))
{
- return (new PEAR_Error('Group names must contain at
least one non-punctuation character.'));
+ return (new PEAR_Error("Not allowed to create a group
called '$name' (reserved word)!"));
}
-
- if (strtolower($name) == 'new')
- {
- return (new PEAR_Error('Not allowed to create a group
called \'new\'!'));
- }
// Check to make sure no existing group with same name
(case-insensitive).
$q = sprintf('SELECT groupname FROM Groups WHERE
LOWER(groupname)=LOWER(%s)'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1271] Regexp logic fixes.,
Toby Inkster <=