Permalink
Browse files

Split Utils into many smaller classes.

  • Loading branch information...
1 parent b576e43 commit 15502ced8ee2fc51447c30518669bba6e89d86d3 @cdujeu cdujeu committed Jun 24, 2016
Showing with 3,239 additions and 2,578 deletions.
  1. +3 −3 core/src/conf/bootstrap_context.php
  2. +3 −3 core/src/core/doc/PREVIOUS_RELEASES
  3. +2 −1 core/src/core/src/lib/pclzip.lib.php
  4. +0 −1 core/src/core/src/pydio/Core/Controller/CliRunner.php
  5. +1 −1 core/src/core/src/pydio/Core/{Utils → Controller}/UnixProcess.php
  6. +19 −18 core/src/core/src/pydio/Core/Controller/XMLWriter.php
  7. +6 −2 core/src/core/src/pydio/Core/Http/Cli/AuthCliMiddleware.php
  8. +16 −3 core/src/core/src/pydio/Core/Http/Message/RegistryMessage.php
  9. +17 −3 core/src/core/src/pydio/Core/Http/Middleware/SapiMiddleware.php
  10. +2 −2 core/src/core/src/pydio/Core/Http/Middleware/SecureTokenMiddleware.php
  11. +2 −2 core/src/core/src/pydio/Core/Http/Middleware/SessionRepositoryMiddleware.php
  12. +3 −3 core/src/core/src/pydio/Core/Http/Response/FileReaderResponse.php
  13. +6 −2 core/src/core/src/pydio/Core/Http/Rest/RestAuthMiddleware.php
  14. +8 −9 core/src/core/src/pydio/Core/PluginFramework/PluginsService.php
  15. +6 −6 core/src/core/src/pydio/Core/Serializer/RepositoryXML.php
  16. +6 −6 core/src/core/src/pydio/Core/Services/AuthService.php
  17. +8 −4 core/src/core/src/pydio/Core/Services/ConfService.php
  18. +1 −1 core/src/core/src/pydio/Core/Services/LocaleService.php
  19. +1 −1 core/src/core/src/pydio/Core/Services/UsersService.php
  20. +184 −0 core/src/core/src/pydio/Core/Utils/ApplicationState.php
  21. +104 −0 core/src/core/src/pydio/Core/Utils/DBHelper.php
  22. +146 −0 core/src/core/src/pydio/Core/Utils/FileHelper.php
  23. +4 −3 core/src/core/src/pydio/Core/Utils/{ → Http}/BruteForceHelper.php
  24. +1 −3 core/src/core/src/pydio/Core/Utils/{ → Http}/CaptchaProvider.php
  25. +8 −3 core/src/core/src/pydio/Core/Utils/{ → Http}/CookiesHelper.php
  26. +212 −0 core/src/core/src/pydio/Core/Utils/Http/UserAgent.php
  27. +179 −0 core/src/core/src/pydio/Core/Utils/Reflection/DiagnosticRunner.php
  28. +137 −0 core/src/core/src/pydio/Core/Utils/Reflection/DocsParser.php
  29. +1 −1 core/src/core/src/pydio/Core/Utils/{ → Reflection}/JSPacker.php
  30. +179 −0 core/src/core/src/pydio/Core/Utils/Reflection/LocaleExtractor.php
  31. +1 −1 core/src/core/src/pydio/Core/Utils/{ → Reflection}/PydioSdkGenerator.php
  32. +0 −1,907 core/src/core/src/pydio/Core/Utils/Utils.php
  33. +277 −0 core/src/core/src/pydio/Core/Utils/Vars/InputFilter.php
  34. +240 −0 core/src/core/src/pydio/Core/Utils/Vars/OptionsHelper.php
  35. +176 −0 core/src/core/src/pydio/Core/Utils/Vars/PasswordEncoder.php
  36. +54 −0 core/src/core/src/pydio/Core/Utils/Vars/PathUtils.php
  37. +1 −1 core/src/core/src/pydio/Core/Utils/{ → Vars}/StatHelper.php
  38. +320 −0 core/src/core/src/pydio/Core/Utils/Vars/StringHelper.php
  39. +44 −0 core/src/core/src/pydio/Core/Utils/Vars/UrlUtils.php
  40. +1 −1 core/src/core/src/pydio/Core/Utils/{ → Vars}/VarsFilter.php
  41. +1 −1 core/src/core/src/pydio/Tests/PHPCLI.php
  42. +1 −1 core/src/core/src/pydio/Tests/Writeability.php
  43. +62 −57 core/src/plugins/access.ajxp_conf/ConfAccessDriver.php
  44. +40 −37 core/src/plugins/access.fs/FsAccessDriver.php
  45. +9 −7 core/src/plugins/access.fs/FsAccessWrapper.php
  46. +3 −3 core/src/plugins/access.ftp/FtpAccessDriver.php
  47. +23 −19 core/src/plugins/access.ftp/FtpAccessWrapper.php
  48. +1 −2 core/src/plugins/access.imap/ImapAccessDriver.php
  49. +2 −2 core/src/plugins/access.imap/ImapAccessWrapper.php
  50. +6 −6 core/src/plugins/access.inbox/InboxAccessDriver.php
  51. +5 −5 core/src/plugins/access.inbox/InboxAccessWrapper.php
  52. +2 −2 core/src/plugins/access.jsapi/JsapiAccessDriver.php
  53. +17 −8 core/src/plugins/access.mysql/MysqlAccessDriver.php
  54. +4 −3 core/src/plugins/access.s3/S3AccessWrapper.php
  55. +3 −3 core/src/plugins/access.sftp/SFTPAccessDriver.php
  56. +4 −3 core/src/plugins/access.sftp/SFTPAccessWrapper.php
  57. +6 −4 core/src/plugins/access.sftp_psl/SftpPSLAccessWrapper.php
  58. +3 −3 core/src/plugins/access.smb/SMBAccessWrapper.php
  59. +4 −3 core/src/plugins/access.swift/SwiftAccessWrapper.php
  60. +1 −1 core/src/plugins/action.antivirus/AntivirusScanner.php
  61. +7 −5 core/src/plugins/action.compression/PluginCompression.php
  62. +6 −5 core/src/plugins/action.powerfs/PowerFSController.php
  63. +14 −13 core/src/plugins/action.scheduler/Scheduler.php
  64. +2 −2 core/src/plugins/action.share/src/Model/CompositeShare.php
  65. +4 −3 core/src/plugins/action.share/src/Model/ShareLink.php
  66. +13 −11 core/src/plugins/action.share/src/ShareCenter.php
  67. +4 −4 core/src/plugins/action.share/src/Store/ShareRightsManager.php
  68. +4 −3 core/src/plugins/action.share/src/View/MinisiteRenderer.php
  69. +7 −7 core/src/plugins/action.share/src/View/PublicAccessManager.php
  70. +2 −2 core/src/plugins/action.updater/UpdateController.php
  71. +5 −4 core/src/plugins/action.updater/UpgradeManager.php
  72. +12 −10 core/src/plugins/auth.custom_db/CustomDbAuthDriver.php
  73. +3 −3 core/src/plugins/auth.ldap/LdapAuthDriver.php
  74. +12 −10 core/src/plugins/auth.remote/RemoteAuthDriver.php
  75. +14 −11 core/src/plugins/auth.sql/SqlAuthDriver.php
  76. +2 −2 core/src/plugins/authfront.cas/CasAuthFrontend.php
  77. +7 −5 core/src/plugins/authfront.keystore/KeystoreAuthFrontend.php
  78. +7 −6 core/src/plugins/authfront.session_login/SessionLoginFrontend.php
  79. +17 −12 core/src/plugins/boot.conf/BootConfLoader.php
  80. +3 −2 core/src/plugins/cache.doctrine/DoctrineCacheDriver.php
  81. +14 −11 core/src/plugins/conf.sql/SqlConfDriver.php
  82. +3 −4 core/src/plugins/conf.sql/SqlUser.php
  83. +9 −7 core/src/plugins/core.access/src/AbstractAccessDriver.php
  84. +2 −2 core/src/plugins/core.access/src/Filter/AJXP_PermissionMask.php
  85. +3 −2 core/src/plugins/core.access/src/Filter/ContentFilter.php
  86. +2 −2 core/src/plugins/core.access/src/Model/AJXP_Node.php
  87. +2 −2 core/src/plugins/core.access/src/Model/NodesDiff.php
  88. +8 −6 core/src/plugins/core.access/src/Model/Repository.php
  89. +11 −9 core/src/plugins/core.access/src/Model/UserSelection.php
  90. +3 −2 core/src/plugins/core.access/src/RecycleBinManager.php
  91. +3 −2 core/src/plugins/core.access/src/Stream/AuthWrapper.php
  92. +4 −3 core/src/plugins/core.access/src/Stream/OAuthStream.php
  93. +1 −1 core/src/plugins/core.access/src/Stream/PydioStreamWrapper.php
  94. +3 −3 core/src/plugins/core.access/src/Stream/StreamWrapper.php
  95. +4 −3 core/src/plugins/core.auth/MemorySafe.php
  96. +3 −2 core/src/plugins/core.cache/CoreCacheLoader.php
  97. +32 −29 core/src/plugins/core.conf/AbstractConfDriver.php
  98. +3 −2 core/src/plugins/core.conf/CoreConfLoader.php
  99. +5 −4 core/src/plugins/core.index/AbstractSearchEngineIndexer.php
  100. +6 −4 core/src/plugins/core.mailer/Mailer.php
  101. +6 −4 core/src/plugins/core.mq/MqManager.php
  102. +4 −3 core/src/plugins/core.notifications/Notification.php
  103. +1 −1 core/src/plugins/core.notifications/NotificationCenter.php
  104. +4 −3 core/src/plugins/core.ocs/src/ActionsController.php
  105. +3 −2 core/src/plugins/core.ocs/src/Client/OCSClient.php
  106. +9 −8 core/src/plugins/core.ocs/src/Server/Federated/Server.php
  107. +7 −4 core/src/plugins/core.tasks/src/TaskController.php
  108. +4 −3 core/src/plugins/core.tasks/src/TaskService.php
  109. +1 −1 core/src/plugins/core.uploader/CoreUploaderLoader.php
  110. +3 −2 core/src/plugins/cypher.encfs/EncfsMounter.php
  111. +3 −2 core/src/plugins/editor.audio/AudioPreviewer.php
  112. +1 −1 core/src/plugins/editor.diaporama/ImagePreviewer.php
  113. +3 −2 core/src/plugins/editor.diaporama/PThumb.lib.php
  114. +11 −7 core/src/plugins/editor.eml/EmlParser.php
  115. +5 −3 core/src/plugins/editor.etherpad/EtherpadClient.php
  116. +7 −5 core/src/plugins/editor.imagick/IMagickPreviewer.php
  117. +6 −4 core/src/plugins/editor.pixlr/PixlrEditor.php
  118. +3 −2 core/src/plugins/editor.video/VideoReader.php
  119. +6 −5 core/src/plugins/editor.webodf/frame.php
  120. +5 −3 core/src/plugins/editor.zoho/ZohoEditor.php
  121. +30 −6 core/src/plugins/feed.sql/SqlFeedStore.php
  122. +114 −7 core/src/plugins/gui.ajax/RichClient.php
  123. +5 −4 core/src/plugins/gui.ios/MobileNativeRedirect.php
  124. +3 −2 core/src/plugins/gui.mobile/MobileGuiPlugin.php
  125. +8 −5 core/src/plugins/gui.user/UserGuiController.php
  126. +3 −2 core/src/plugins/index.elasticsearch/ElasticSearchIndexer.php
  127. +1 −1 core/src/plugins/index.lucene/LuceneIndexer.php
  128. +25 −19 core/src/plugins/log.sql/SqlLogDriver.php
  129. +7 −5 core/src/plugins/log.text/TextLogDriver.php
  130. +7 −6 core/src/plugins/meta.comments/CommentsMetaManager.php
  131. +3 −2 core/src/plugins/meta.exif/ExifMetaManager.php
  132. +3 −2 core/src/plugins/meta.exif/ExifXmlMessage.php
  133. +3 −2 core/src/plugins/meta.filehasher/FileHasher.php
  134. +8 −6 core/src/plugins/meta.git/GitManager.php
  135. +1 −1 core/src/plugins/meta.mount/FilesystemMounter.php
  136. +1 −1 core/src/plugins/meta.quota/QuotaComputer.php
  137. +7 −6 core/src/plugins/meta.svn/SvnManager.php
  138. +8 −6 core/src/plugins/meta.syncable/ChangesTracker.php
  139. +4 −3 core/src/plugins/meta.user/UserMetaManager.php
  140. +4 −3 core/src/plugins/mq.serial/SerialMessageExchanger.php
  141. +15 −6 core/src/plugins/mq.sql/SqlMessageExchanger.php
  142. +6 −5 core/src/plugins/shorten.multi/MultiShortener.php
  143. +1 −1 core/src/plugins/uploader.flex/FlexUpload.php
  144. +5 −4 core/src/plugins/uploader.html/SimpleUpload.php
  145. +7 −6 core/src/plugins/uploader.http/HttpDownload.php
  146. +15 −12 core/src/plugins/uploader.jumploader/Jumploader.php
  147. +7 −5 core/src/plugins/uploader.plupload/Pluploader.php
  148. +4 −4 core/src/runTests.php
@@ -125,14 +125,14 @@ function pydioAutoloader($className)
include_once(AJXP_INSTALL_PATH . "/core/compat.php");
-use Pydio\Core\Utils\Utils;
+use Pydio\Core\Utils\ApplicationState;
-Utils::safeIniSet("session.cookie_httponly", 1);
+ApplicationState::safeIniSet("session.cookie_httponly", 1);
if (is_file(AJXP_CONF_PATH."/bootstrap_conf.php")) {
include(AJXP_CONF_PATH."/bootstrap_conf.php");
if (isSet($AJXP_INISET)) {
- foreach($AJXP_INISET as $key => $value) Utils::safeIniSet($key, $value);
+ foreach($AJXP_INISET as $key => $value) ApplicationState::safeIniSet($key, $value);
}
if (defined('AJXP_LOCALE')) {
setlocale(LC_CTYPE, AJXP_LOCALE);
@@ -2347,7 +2347,7 @@ Rework "regexp" in listUsersPaginated / getUsersCount in class.sqlAuthDriver.php
Use HTML base tag instead of the previous complicated "travel_path_to_root" mechanism...
New access point for managing users self-service operations (currently reset password)
Make custom sort function to make sure users are sorted (fix #279)
-New variable AJXP_SANITIZE_FILENAME, to be less restrictive on the allowed characters than AJXP_SANITIZE_HTML_STRICT. Particularly, allow commas in filename.
+New variable InputFilter::SANITIZE_FILENAME, to be less restrictive on the allowed characters than InputFilter::SANITIZE_HTML_STRICT. Particularly, allow commas in filename.
Login: trim username and password to avoid trailing and ending white space problems
Better API for get_my_feed. Ability to force recycle_bin creation in workspace share
Add node.share.create hooks
@@ -2564,7 +2564,7 @@ preg_replace(): The /e modifier is deprecated in PHP5.5
Fix #404
Fix #392, by adding PRE and POST callbacks to PclZip
skipSecureToken actions were not taken into accounts in external files.
-Disable at last native autocompletion on share dialog, by removing name attribute. Styling of the Minisite, customize Logo Always sanitize user names as AJXP_SANITIZE_EMAILCHARS Users dashboard, revert styling of FetchedResultPane, was ugly. To be improved still.
+Disable at last native autocompletion on share dialog, by removing name attribute. Styling of the Minisite, customize Logo Always sanitize user names as InputFilter::SANITIZE_EMAILCHARS Users dashboard, revert styling of FetchedResultPane, was ugly. To be improved still.
Detect if minisite logo is a binary or a real filepath
Fix log.sql for ipv6 logging
Add a paddingBottom when FilesList is in gridMode, to avoid hiding last line with scrollbar, fix #172
@@ -2861,7 +2861,7 @@ serialized data can contain null bytes, store them in blob (details)
New functions in to be implemented by conf plugins (save/load/clearTemporaryKey, pruneTemporaryKeys) (details)
Replace AJXP_REBASE if present in the html templates and passed in START_PARAMETERS (details)
FS: Pass __AJXP_ZIP_FLAT__ to makeZip function to force all files to be at level 0 Fix tabulator et splitter resizing issues Download Cart. (details)
-New variable AJXP_SANITIZE_FILENAME, to be less restrictive on the allowed characters than AJXP_SANITIZE_HTML_STRICT. Particularly, allow commas in filename. (details)
+New variable InputFilter::SANITIZE_FILENAME, to be less restrictive on the allowed characters than InputFilter::SANITIZE_HTML_STRICT. Particularly, allow commas in filename. (details)
New invisibleBar, and autoFoldOnEvent options on Splitter New tabsTips option on Tabulator Fix simpleTooltip positioning and style Rework layout here and there, implements the new behaviours, still to be tested and validated. (details)
Expand and fix widgets, add a mode for horizontal tabulator positioning. (details)
@@ -26,6 +26,7 @@
// --------------------------------------------------------------------------------
// ----- Constants
+use Pydio\Core\Utils\ApplicationState;
use Pydio\Core\Utils\Utils;
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
@@ -65,7 +66,7 @@
// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
if (!defined('PCLZIP_TEMPORARY_DIR')) {
- define( 'PCLZIP_TEMPORARY_DIR', Utils::getAjxpTmpDir().DIRECTORY_SEPARATOR );
+ define( 'PCLZIP_TEMPORARY_DIR', ApplicationState::getAjxpTmpDir() .DIRECTORY_SEPARATOR );
}
// ----- Optional threshold ratio for use of temporary files
@@ -24,7 +24,6 @@
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\UsersService;
-use Pydio\Core\Utils\UnixProcess;
use Pydio\Log\Core\Logger;
use Pydio\Tasks\Task;
use Pydio\Tasks\TaskService;
@@ -18,7 +18,7 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
-namespace Pydio\Core\Utils;
+namespace Pydio\Core\Controller;
defined('AJXP_EXEC') or die( 'Access not allowed');
/**
@@ -24,8 +24,9 @@
use Pydio\Access\Core\IAjxpWrapperProvider;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services\LocaleService;
-use Pydio\Core\Utils\StatHelper;
-use Pydio\Core\Utils\Utils;
+use Pydio\Core\Utils\Vars\InputFilter;
+use Pydio\Core\Utils\Vars\StatHelper;
+use Pydio\Core\Utils\Vars\StringHelper;
use Pydio\Core\Services;
use Pydio\Core\Services\ConfService;
@@ -199,18 +200,18 @@ public static function renderNode($nodeName, $nodeLabel, $isLeaf, $metaData = ar
{
$string = "<tree";
$metaData["filename"] = $nodeName;
- if(Utils::detectXSS($nodeName)) $metaData["filename"] = "/XSS Detected - Please contact your admin";
+ if(InputFilter::detectXSS($nodeName)) $metaData["filename"] = "/XSS Detected - Please contact your admin";
if (!isSet($metaData["text"])) {
- if(Utils::detectXSS($nodeLabel)) $nodeLabel = "XSS Detected - Please contact your admin";
+ if(InputFilter::detectXSS($nodeLabel)) $nodeLabel = "XSS Detected - Please contact your admin";
$metaData["text"] = $nodeLabel;
}else{
- if(Utils::detectXSS($metaData["text"])) $metaData["text"] = "XSS Detected - Please contact your admin";
+ if(InputFilter::detectXSS($metaData["text"])) $metaData["text"] = "XSS Detected - Please contact your admin";
}
$metaData["is_file"] = ($isLeaf?"true":"false");
$metaData["ajxp_im_time"] = time();
foreach ($metaData as $key => $value) {
- if(Utils::detectXSS($value)) $value = "XSS Detected!";
- $value = Utils::xmlEntities($value, true);
+ if(InputFilter::detectXSS($value)) $value = "XSS Detected!";
+ $value = StringHelper::xmlEntities($value, true);
$string .= " $key=\"$value\"";
}
if ($close) {
@@ -286,7 +287,7 @@ public static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
- $xml = str_replace("CONF_MESSAGE[$messId]", Utils::xmlEntities($message), $xml);
+ $xml = str_replace("CONF_MESSAGE[$messId]", StringHelper::xmlEntities($message), $xml);
}
}
if (preg_match_all("/MIXIN_MESSAGE(\[.*?\])/", $xml, $matches, PREG_SET_ORDER)) {
@@ -296,7 +297,7 @@ public static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
if (array_key_exists($messId, $confMessages)) {
$message = $confMessages[$messId];
}
- $xml = str_replace("MIXIN_MESSAGE[$messId]", Utils::xmlEntities($message), $xml);
+ $xml = str_replace("MIXIN_MESSAGE[$messId]", StringHelper::xmlEntities($message), $xml);
}
}
if ($stripSpaces) {
@@ -318,8 +319,8 @@ public static function replaceAjxpXmlKeywords($xml, $stripSpaces = false)
*/
public static function reloadDataNode($nodePath="", $pendingSelection="", $print = true)
{
- $nodePath = Utils::xmlEntities($nodePath, true);
- $pendingSelection = Utils::xmlEntities($pendingSelection, true);
+ $nodePath = StringHelper::xmlEntities($nodePath, true);
+ $pendingSelection = StringHelper::xmlEntities($pendingSelection, true);
return XMLWriter::write("<reload_instruction object=\"data\" node=\"$nodePath\" file=\"$pendingSelection\"/>", $print);
}
@@ -341,7 +342,7 @@ public static function writeNodesDiff($diffNodes, $print = false)
if (isSet($diffNodes["REMOVE"]) && count($diffNodes["REMOVE"])) {
$buffer .= "<remove>";
foreach ($diffNodes["REMOVE"] as $nodePath) {
- $nodePath = Utils::xmlEntities($nodePath, true);
+ $nodePath = StringHelper::xmlEntities($nodePath, true);
$buffer .= "<tree filename=\"$nodePath\" ajxp_im_time=\"".time()."\"/>";
}
$buffer .= "</remove>";
@@ -406,10 +407,10 @@ public static function requireAuth($print = true)
*/
public static function triggerBgAction($actionName, $parameters, $messageId, $print=true, $delay = 0)
{
- $messageId = Utils::xmlEntities($messageId);
+ $messageId = StringHelper::xmlEntities($messageId);
$data = XMLWriter::write("<trigger_bg_action name=\"$actionName\" messageId=\"$messageId\" delay=\"$delay\">", $print);
foreach ($parameters as $paramName=>$paramValue) {
- $paramValue = Utils::xmlEntities($paramValue);
+ $paramValue = StringHelper::xmlEntities($paramValue);
$data .= XMLWriter::write("<param name=\"$paramName\" value=\"$paramValue\"/>", $print);
}
$data .= XMLWriter::write("</trigger_bg_action>", $print);
@@ -469,7 +470,7 @@ public static function writeBookmarks($allBookmarks, $context, $print = true, $f
$buffer .= XMLWriter::renderNode($path, $title, false, array('icon' => "mime_empty.png"), true, false);
}
} else {
- $buffer .= "<bookmark path=\"".Utils::xmlEntities($path, true)."\" title=\"".Utils::xmlEntities($title, true)."\"/>";
+ $buffer .= "<bookmark path=\"". StringHelper::xmlEntities($path, true) ."\" title=\"". StringHelper::xmlEntities($title, true) ."\"/>";
}
}
if($print) {
@@ -502,7 +503,7 @@ public static function sendFilesListComponentConfig($config)
public static function toXmlElement($tagName, $attributes, $xmlChildren = ""){
$buffer = "<$tagName ";
foreach ($attributes as $attName => $attValue){
- $buffer.= "$attName=\"".Utils::xmlEntities($attValue)."\" ";
+ $buffer.= "$attName=\"". StringHelper::xmlEntities($attValue) ."\" ";
}
if(!strlen($xmlChildren)) {
$buffer .= "/>";
@@ -523,10 +524,10 @@ public static function sendMessage($logMessage, $errorMessage, $print = true)
{
if ($errorMessage == null) {
$messageType = "SUCCESS";
- $message = Utils::xmlContentEntities($logMessage);
+ $message = StringHelper::xmlContentEntities($logMessage);
} else {
$messageType = "ERROR";
- $message = Utils::xmlContentEntities($errorMessage);
+ $message = StringHelper::xmlContentEntities($errorMessage);
}
return XMLWriter::write("<message type=\"$messageType\">".$message."</message>", $print);
}
@@ -34,14 +34,18 @@
use Pydio\Core\Services\RepositoryService;
use Pydio\Core\Services\RolesService;
use Pydio\Core\Services\UsersService;
+use Pydio\Core\Utils\ApplicationState;
use Pydio\Core\Utils\TextEncoder;
use Pydio\Core\Utils\Utils;
use Pydio\Log\Core\Logger;
use Zend\Diactoros\Response;
defined('AJXP_EXEC') or die('Access not allowed');
-
+/**
+ * Authenticatino middleware used in Command Line context
+ * @package Pydio\Core\Http\Cli
+ */
class AuthCliMiddleware
{
/**
@@ -155,7 +159,7 @@ public static function handleRequest(ServerRequestInterface $requestInterface, R
$requestInterface = $requestInterface->withAttribute("action", $options["a"]);
- if(UsersService::usersEnabled() && Utils::detectApplicationFirstRun()){
+ if(UsersService::usersEnabled() && ApplicationState::detectApplicationFirstRun()){
RolesService::bootSequence();
}
@@ -23,11 +23,15 @@
use Pydio\Core\Controller\XMLWriter;
use Pydio\Core\Http\Response\JSONSerializableResponseChunk;
use Pydio\Core\Http\Response\XMLDocSerializableResponseChunk;
-use Pydio\Core\Utils\Utils;
+use Pydio\Core\Utils\ApplicationState;
defined('AJXP_EXEC') or die('Access not allowed');
-
+/**
+ * Class RegistryMessage
+ * Send a piece or a full registry as XML or JSON
+ * @package Pydio\Core\Http\Message
+ */
class RegistryMessage implements XMLDocSerializableResponseChunk, JSONSerializableResponseChunk
{
/**
@@ -50,6 +54,12 @@ class RegistryMessage implements XMLDocSerializableResponseChunk, JSONSerializab
*/
protected $renderedXML;
+ /**
+ * RegistryMessage constructor.
+ * @param $registry
+ * @param null $xPath
+ * @param null $xPathObject
+ */
public function __construct($registry, $xPath = null, $xPathObject = null)
{
$this->registry = $registry;
@@ -58,6 +68,9 @@ public function __construct($registry, $xPath = null, $xPathObject = null)
}
+ /**
+ * @return string
+ */
public function getCharset()
{
return "UTF-8";
@@ -85,7 +98,7 @@ public function toXML()
} else {
- Utils::safeIniSet("zlib.output_compression", "4096");
+ ApplicationState::safeIniSet("zlib.output_compression", "4096");
$xml = XMLWriter::replaceAjxpXmlKeywords($this->registry->saveXML());
}
@@ -26,11 +26,15 @@
use Pydio\Core\Http\Response\SerializableResponseStream;
use Pydio\Core\Http\Server;
-use Pydio\Core\Utils\Utils;
+use Pydio\Core\Utils\Vars\InputFilter;
defined('AJXP_EXEC') or die('Access not allowed');
-
+/**
+ * Class SapiMiddleware
+ * Main Middleware for Http requests
+ * @package Pydio\Core\Http\Middleware
+ */
class SapiMiddleware implements ITopLevelMiddleware
{
@@ -68,6 +72,10 @@ public function handleRequest(ServerRequestInterface $request, ResponseInterface
$this->emitResponse($request, $response);
}
+ /**
+ * @param ServerRequestInterface $request
+ * @param ResponseInterface $responseInterface
+ */
protected function parseRequestRouteAndParams(ServerRequestInterface &$request, ResponseInterface &$responseInterface){
$serverData = $request->getServerParams();
@@ -82,12 +90,18 @@ protected function parseRequestRouteAndParams(ServerRequestInterface &$request,
$action = (strpos($serverData["HTTP_ACCEPT"], "text/html") !== false ? "get_boot_gui" : "ping");
}
$request = $request
- ->withAttribute("action", Utils::sanitize($action, AJXP_SANITIZE_EMAILCHARS))
+ ->withAttribute("action", InputFilter::sanitize($action, InputFilter::SANITIZE_EMAILCHARS))
->withAttribute("api", "session")
;
}
+ /**
+ * Output the response to the browser, if no headers were already sent.
+ * @param ServerRequestInterface $request
+ * @param ResponseInterface $response
+ * @return void
+ */
public function emitResponse(ServerRequestInterface $request, ResponseInterface $response){
if($response !== false && $response->getBody() && $response->getBody() instanceof SerializableResponseStream){
/**
@@ -25,7 +25,7 @@
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Http\Server;
use Pydio\Core\PluginFramework\PluginsService;
-use Pydio\Core\Utils\Utils;
+use Pydio\Core\Utils\Vars\StringHelper;
defined('AJXP_EXEC') or die('Access not allowed');
@@ -85,7 +85,7 @@ public static function generateSecureToken()
$_SESSION["SECURE_TOKENS"][] = $_SESSION["FORCE_SECURE_TOKEN"];
return $_SESSION["FORCE_SECURE_TOKEN"];
}
- $newToken = Utils::generateRandomString(32);
+ $newToken = StringHelper::generateRandomString(32);
$_SESSION["SECURE_TOKENS"][] = $newToken;
return $newToken;
}
@@ -33,7 +33,7 @@
use Pydio\Core\Services\RolesService;
use Pydio\Core\Services\SessionService;
use Pydio\Core\Services\UsersService;
-use Pydio\Core\Utils\Utils;
+use Pydio\Core\Utils\ApplicationState;
use Pydio\Log\Core\Logger;
defined('AJXP_EXEC') or die('Access not allowed');
@@ -98,7 +98,7 @@ public static function handleRequest(ServerRequestInterface &$requestInterface,
LocaleService::setLanguage($requestInterface->getCookieParams()["AJXP_lang"]);
}
- if(UsersService::usersEnabled() && Utils::detectApplicationFirstRun()){
+ if(UsersService::usersEnabled() && ApplicationState::detectApplicationFirstRun()){
try{
RolesService::bootSequence();
}catch (PydioException $e){
@@ -25,9 +25,9 @@
use Pydio\Access\Driver\StreamProvider\FS\FsAccessWrapper;
use Pydio\Core\Controller\HTMLWriter;
use Pydio\Core\Services\ConfService;
-use Pydio\Core\Utils\StatHelper;
+use Pydio\Core\Utils\ApplicationState;
+use Pydio\Core\Utils\Vars\StatHelper;
use Pydio\Core\Utils\TextEncoder;
-use Pydio\Core\Utils\Utils;
use Pydio\Log\Core\Logger;
use Zend\Diactoros\ServerRequestFactory;
@@ -196,7 +196,7 @@ public function readFile($node = null, $filePath = null, $data = null, $headerTy
set_error_handler('Pydio\Access\Driver\StreamProvider\FS\download_exception_handler');
// required for IE, otherwise Content-disposition is ignored
if (ini_get('zlib.output_compression')) {
- Utils::safeIniSet('zlib.output_compression', 'Off');
+ ApplicationState::safeIniSet('zlib.output_compression', 'Off');
}
$isFile = ($data !== null) && !$confGzip;
Oops, something went wrong.

0 comments on commit 15502ce

Please sign in to comment.