A fix to rights mudule

If you get error like:

preg_match() [<a href=‘function.preg-match’>function.preg-match</a>]: Compilation failed: missing terminating ] for character class at offset 30

/protected/modules/rights/components/RAuthorizer.php(448)

That indicates your php setup includes some unusual functions that may cause problems. So, I modify the file to avoid this problem, and may help some guys.Just a advice, if you have a better solution, just share to us.

File:rights\components\RAuthorizer.php

Line:447-450

Source:

	foreach( &#036;functions as &#036;f ){


		if(preg_match('/'.&#036;f.'&#092; *&#092;({1}/', &#036;code)&gt;0 )


			return null; // Function call found, not safe for eval.


	}

To:

	foreach( &#036;functions as &#036;f ){


		if(preg_match('/^[a-zA-Z_][a-zA-Z_0-9]*&#036;/i', &#036;f) &amp;&amp; preg_match('/'.&#036;f.'&#092; *&#092;({1}/', &#036;code)&gt;0 )


			return null; // Function call found, not safe for eval.


	}

Perhaps you should put this on the extension page itself?

http://www.yiiframework.com/extension/rights/

And the forum thread.

http://www.yiiframework.com/forum/index.php?/topic/10556-extension-rights/page__p__51869#entry51869