Put regex rules between single quotes
This commit is contained in:
parent
d52c6184b9
commit
f05c228f1d
|
@ -8,7 +8,7 @@ class CORSHelper
|
|||
$origin = $request->getHeader('Origin');
|
||||
$allowedOrigins = self::getAllowedOrigins($request);
|
||||
|
||||
if ((!(preg_match("/https?:\/\/localhost/", $origin) === 1)) && ($origin != '')
|
||||
if ((!(preg_match('/https?:\/\/localhost/', $origin) === 1)) && ($origin != '')
|
||||
&& (!in_array($origin, $allowedOrigins))
|
||||
) {
|
||||
//Don't allow CORS from other domains to prevent XSS.
|
||||
|
|
|
@ -69,7 +69,7 @@ class Application_Common_Database
|
|||
$new_params[$k] = $new_params[$v];
|
||||
} else {
|
||||
foreach (range(1, $matches_count) as $i) {
|
||||
preg_replace("/{$k}(\D)/", "{$k}{$i}${1}", $sql, 1);
|
||||
preg_replace('/' . $k . '(\D)/', "{$k}{$i}${1}", $sql, 1);
|
||||
$new_params[$k . $i] = $v;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -850,7 +850,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]);
|
||||
// validation on type of column
|
||||
if (in_array($d['sp_criteria_field'], ['length', 'cuein', 'cueout'])) {
|
||||
if (!preg_match("/^(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
|
||||
if (!preg_match('/^(\d{2}):(\d{2}):(\d{2})/', $d['sp_criteria_value'])) {
|
||||
$element->addError(_("'Length' should be in '00:00:00' format"));
|
||||
$isValid = false;
|
||||
}
|
||||
|
@ -868,7 +868,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$isValid = false;
|
||||
}
|
||||
} else {
|
||||
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
|
||||
if (!preg_match('/(\d{4})-(\d{2})-(\d{2})/', $d['sp_criteria_value'])) {
|
||||
$element->addError(_('The value should be in timestamp format (e.g. 0000-00-00 or 0000-00-00 00:00:00)'));
|
||||
$isValid = false;
|
||||
} else {
|
||||
|
@ -893,7 +893,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$isValid = false;
|
||||
}
|
||||
} else {
|
||||
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
|
||||
if (!preg_match('/(\d{4})-(\d{2})-(\d{2})/', $d['sp_criteria_extra'])) {
|
||||
$element->addError(_('The value should be in timestamp format (e.g. 0000-00-00 or 0000-00-00 00:00:00)'));
|
||||
$isValid = false;
|
||||
} else {
|
||||
|
|
|
@ -913,7 +913,7 @@ class Application_Model_Preference
|
|||
|
||||
public static function SetLatestVersion($version)
|
||||
{
|
||||
$pattern = "/^[0-9]+\.[0-9]+\.[0-9]+/";
|
||||
$pattern = '/^[0-9]+\.[0-9]+\.[0-9]+/';
|
||||
if (preg_match($pattern, $version)) {
|
||||
self::setValue('latest_version', $version);
|
||||
}
|
||||
|
@ -932,8 +932,8 @@ class Application_Model_Preference
|
|||
public static function SetLatestLink($link)
|
||||
{
|
||||
$pattern = '#^(http|https|ftp)://' .
|
||||
"([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+" .
|
||||
"(/[a-zA-Z0-9\-\.\_\~\:\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+)*/?$#";
|
||||
'([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+' .
|
||||
'(/[a-zA-Z0-9\-\.\_\~\:\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+)*/?$#';
|
||||
if (preg_match($pattern, $link)) {
|
||||
self::setValue('latest_link', $link);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
|
||||
$di = null;
|
||||
$length = $parameters['length'];
|
||||
$result = preg_match("/^(?:([0-9]{1,2})h)?\s*(?:([0-9]{1,2})m)?$/", $length, $matches);
|
||||
$result = preg_match('/^(?:([0-9]{1,2})h)?\s*(?:([0-9]{1,2})m)?$/', $length, $matches);
|
||||
|
||||
$invalid_date_interval = false;
|
||||
if ($result == 1 && count($matches) == 2) {
|
||||
|
@ -171,7 +171,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
//simple validator that checks to make sure that the url starts with
|
||||
//http(s),
|
||||
//and that the domain is at least 1 letter long
|
||||
$result = preg_match("/^(http|https):\/\/.+/", $url, $matches);
|
||||
$result = preg_match('/^(http|https):\/\/.+/', $url, $matches);
|
||||
|
||||
$mime = null;
|
||||
$mediaUrl = null;
|
||||
|
@ -189,7 +189,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
}
|
||||
$mediaUrl = self::getMediaUrl($url, $mime, $content_length_found);
|
||||
|
||||
if (preg_match("/(x-mpegurl)|(xspf\+xml)|(pls\+xml)|(x-scpls)/", $mime)) {
|
||||
if (preg_match('/(x-mpegurl)|(xspf\+xml)|(pls\+xml)|(x-scpls)/', $mime)) {
|
||||
list($mime, $content_length_found) = self::discoverStreamMime($mediaUrl);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
@ -318,11 +318,11 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
{
|
||||
if (preg_match('/x-mpegurl/', $mime)) {
|
||||
$media_url = self::getM3uUrl($url);
|
||||
} elseif (preg_match("/xspf\+xml/", $mime)) {
|
||||
} elseif (preg_match('/xspf\+xml/', $mime)) {
|
||||
$media_url = self::getXspfUrl($url);
|
||||
} elseif (preg_match("/pls\+xml/", $mime) || preg_match('/x-scpls/', $mime)) {
|
||||
} elseif (preg_match('/pls\+xml/', $mime) || preg_match('/x-scpls/', $mime)) {
|
||||
$media_url = self::getPlsUrl($url);
|
||||
} elseif (preg_match("/(mpeg|ogg|audio\/aacp|audio\/aac)/", $mime)) {
|
||||
} elseif (preg_match('/(mpeg|ogg|audio\/aacp|audio\/aac)/', $mime)) {
|
||||
if ($content_length_found) {
|
||||
throw new Exception(_('Invalid webstream - This appears to be a file download.'));
|
||||
}
|
||||
|
|
|
@ -483,7 +483,7 @@ class CcFiles extends BaseCcFiles
|
|||
private static function stripTimeStampFromYearTag($metadata)
|
||||
{
|
||||
if (isset($metadata['year'])) {
|
||||
if (preg_match("/^(\d{4})-(\d{2})-(\d{2})(?:\s+(\d{2}):(\d{2}):(\d{2}))?$/", $metadata['year'])) {
|
||||
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})(?:\s+(\d{2}):(\d{2}):(\d{2}))?$/', $metadata['year'])) {
|
||||
$metadata['year'] = substr($metadata['year'], 0, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract
|
|||
|
||||
$parts = [];
|
||||
if (!$isGit) {
|
||||
$parts = preg_split("/(\.|-)/", $version);
|
||||
$parts = preg_split('/(\.|-)/', $version);
|
||||
}
|
||||
if (count($parts) < 3) {
|
||||
$parts = [0, 0, 0];
|
||||
|
|
Loading…
Reference in New Issue