mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-26 22:02:13 +09:00
Clean up namespaces
This commit is contained in:
parent
4407af2b0f
commit
cb229c2d66
26 changed files with 205 additions and 200 deletions
|
|
@ -53,8 +53,8 @@ else
|
|||
*/
|
||||
if (isset($_SERVER['HTTP_CF_CONNECTING_IP']))
|
||||
{
|
||||
include_once __DIR__ . '/framework/security/ipfilter.php';
|
||||
Rhymix\Framework\Security\IpFilter::getCloudFlareRealIP();
|
||||
include_once __DIR__ . '/framework/filters/ipfilter.php';
|
||||
Rhymix\Framework\Filters\IpFilter::getCloudFlareRealIP();
|
||||
}
|
||||
if (isset($_SERVER['REMOTE_ADDR']) && preg_match('/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/', $_SERVER['REMOTE_ADDR'], $matches))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Config
|
|||
}
|
||||
else
|
||||
{
|
||||
if (self::$_config = Compat\ConfigParser::convert())
|
||||
if (self::$_config = Parsers\ConfigParser::convert())
|
||||
{
|
||||
self::save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Framework\Security;
|
||||
namespace Rhymix\Framework\Filters;
|
||||
|
||||
/**
|
||||
* The filename filter class.
|
||||
|
|
@ -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]);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Framework\Security;
|
||||
namespace Rhymix\Framework\Filters;
|
||||
|
||||
/**
|
||||
* The IP filter class.
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Framework\Compat;
|
||||
namespace Rhymix\Framework\Parsers;
|
||||
|
||||
use Rhymix\Framework\Lang;
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -822,7 +822,7 @@ function url_decode($str)
|
|||
*/
|
||||
function removeHackTag($content)
|
||||
{
|
||||
return Rhymix\Framework\Security\HTMLFilter::clean($content);
|
||||
return Rhymix\Framework\Filters\HTMLFilter::clean($content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -833,7 +833,7 @@ function removeHackTag($content)
|
|||
*/
|
||||
function purifierHtml(&$content)
|
||||
{
|
||||
$content = Rhymix\Framework\Security\HTMLFilter::clean($content);
|
||||
$content = Rhymix\Framework\Filters\HTMLFilter::clean($content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1036,7 +1036,7 @@ function stripEmbedTagForAdmin(&$content, $writer_member_srl)
|
|||
|
||||
$security_msg = '<div style="border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;">' .
|
||||
'<p style="margin: 1em;">' . lang('security_warning_embed') . '</p></div>';
|
||||
$content = Rhymix\Framework\Security\MediaFilter::removeEmbeddedMedia($content, $security_msg);
|
||||
$content = Rhymix\Framework\Filters\MediaFilter::removeEmbeddedMedia($content, $security_msg);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue