Clean up namespaces

This commit is contained in:
Kijin Sung 2016-03-14 21:04:27 +09:00
parent 4407af2b0f
commit cb229c2d66
26 changed files with 205 additions and 200 deletions

View file

@ -34,7 +34,7 @@ class Config
}
else
{
if (self::$_config = Compat\ConfigParser::convert())
if (self::$_config = Parsers\ConfigParser::convert())
{
self::save();
}

View file

@ -445,7 +445,7 @@ class Debug
return $cache = true;
case 'ip':
if (Security\IpFilter::inRanges(RX_CLIENT_IP, Config::get('debug.allow')))
if (Filters\IpFilter::inRanges(RX_CLIENT_IP, Config::get('debug.allow')))
{
return $cache = true;
}

View file

@ -1,6 +1,6 @@
<?php
namespace Rhymix\Framework\Security;
namespace Rhymix\Framework\Filters;
/**
* The filename filter class.

View file

@ -1,6 +1,8 @@
<?php
namespace Rhymix\Framework\Security;
namespace Rhymix\Framework\Filters;
use Rhymix\Framework\Security;
/**
* The HTML filter class.
@ -462,7 +464,7 @@ class HTMLFilter
{
$html = substr($html, 0, 4) . ' src=""' . substr($html, 4);
}
$encoded_properties = \Rhymix\Framework\Security::encrypt(json_encode($attrs));
$encoded_properties = Security::encrypt(json_encode($attrs));
return substr($html, 0, 4) . ' rx_encoded_properties="' . $encoded_properties . '"' . substr($html, 4);
}, $content);
}
@ -477,7 +479,7 @@ class HTMLFilter
{
return preg_replace_callback('!<(div|img)([^>]*)(\srx_encoded_properties="([^"]+)")!i', function($match) {
$attrs = array();
$decoded_properties = \Rhymix\Framework\Security::decrypt($match[4]);
$decoded_properties = Security::decrypt($match[4]);
if (!$decoded_properties)
{
return str_replace($match[3], '', $match[0]);

View file

@ -1,6 +1,6 @@
<?php
namespace Rhymix\Framework\Security;
namespace Rhymix\Framework\Filters;
/**
* The IP filter class.

View file

@ -1,6 +1,8 @@
<?php
namespace Rhymix\Framework\Security;
namespace Rhymix\Framework\Filters;
use Rhymix\Framework\Config;
/**
* The media filter class.
@ -35,8 +37,8 @@ class MediaFilter
if ($permanently)
{
\Rhymix\Framework\Config::set('mediafilter.iframe', self::$_iframe_whitelist);
\Rhymix\Framework\Config::save();
Config::set('mediafilter.iframe', self::$_iframe_whitelist);
Config::save();
}
}
}
@ -63,8 +65,8 @@ class MediaFilter
if ($permanently)
{
\Rhymix\Framework\Config::set('mediafilter.object', self::$_object_whitelist);
\Rhymix\Framework\Config::save();
Config::set('mediafilter.object', self::$_object_whitelist);
Config::save();
}
}
}

View file

@ -156,7 +156,7 @@ class Lang
}
elseif (file_exists("$dir/lang.xml"))
{
$filename = Compat\LangParser::compileXMLtoPHP("$dir/lang.xml", $language === 'ja' ? 'jp' : $language);
$filename = Parsers\LangParser::compileXMLtoPHP("$dir/lang.xml", $language === 'ja' ? 'jp' : $language);
}
elseif (file_exists($dir . '/' . ($language === 'ja' ? 'jp' : $language) . '.lang.php'))
{

View file

@ -1,9 +1,10 @@
<?php
namespace Rhymix\Framework\Compat;
namespace Rhymix\Framework\Parsers;
use Rhymix\Framework\Config;
use Rhymix\Framework\DateTime;
use Rhymix\Framework\Security;
/**
* Config parser class for XE compatibility.
@ -151,9 +152,9 @@ class ConfigParser
}
// Create new crypto keys.
$config['crypto']['encryption_key'] = \Rhymix\Framework\Security::getRandom(64, 'alnum');
$config['crypto']['authentication_key'] = \Rhymix\Framework\Security::getRandom(64, 'alnum');
$config['crypto']['session_key'] = \Rhymix\Framework\Security::getRandom(64, 'alnum');
$config['crypto']['encryption_key'] = Security::getRandom(64, 'alnum');
$config['crypto']['authentication_key'] = Security::getRandom(64, 'alnum');
$config['crypto']['session_key'] = Security::getRandom(64, 'alnum');
// Convert language configuration.
if (isset($db_info->lang_type))

View file

@ -1,6 +1,6 @@
<?php
namespace Rhymix\Framework\Compat;
namespace Rhymix\Framework\Parsers;
use Rhymix\Framework\Lang;

View file

@ -31,12 +31,12 @@ class Security
// Clean up HTML content to prevent XSS attacks.
case 'html':
if (!utf8_check($input)) return false;
return Security\HTMLFilter::clean($input);
return Filters\HTMLFilter::clean($input);
// Clean up the input to be used as a safe filename.
case 'filename':
if (!utf8_check($input)) return false;
return Security\FilenameFilter::clean($input);
return Filters\FilenameFilter::clean($input);
// Unknown filters return false.
default: return false;