Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Code smells and other unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Sep 12, 2016
1 parent 10ee151 commit bc5d1fa
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 67 deletions.
1 change: 0 additions & 1 deletion core/src/core/src/pydio/Core/Http/Server.php
Expand Up @@ -24,7 +24,6 @@
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Core\Exception\PydioException;

use Pydio\Core\Http\Message\PromptMessage;
use Pydio\Core\Http\Message\UserMessage;
use Pydio\Core\Http\Middleware\ITopLevelMiddleware;
use Pydio\Core\Http\Middleware\SapiMiddleware;
Expand Down
5 changes: 4 additions & 1 deletion core/src/core/src/pydio/Tests/AbstractTest.php
Expand Up @@ -20,6 +20,9 @@
*/
namespace Pydio\Tests;

use Pydio\Access\Core\Model\Repository;
use Pydio\Core\Model\RepositoryInterface;

defined('AJXP_EXEC') or die( 'Access not allowed');

global $MAIN_testsArray;
Expand Down Expand Up @@ -72,7 +75,7 @@ public function doTest() { return FALSE; }

/**
* Perform the test on a given repository object, should be overwritten in concrete classes
* @param \Pydio\Access\Core\Model\Repository $repository
* @param Repository|RepositoryInterface $repository
* @return Boolean
*/
public function doRepositoryTest($repository) { return FALSE; }
Expand Down
2 changes: 1 addition & 1 deletion core/src/phpdoc.dist.xml
Expand Up @@ -10,7 +10,7 @@
<directory>core/src/pydio</directory>
<directory>plugins</directory>
<ignore>*phpseclib*</ignore>
<ignore>*vendor/composer*</ignore>
<ignore>*vendor*</ignore>
<ignore>*vendor/phpmailer*</ignore>
<ignore>*lib/class.phpmailer-lite.php</ignore>
<ignore>*openstack-sdk-php*</ignore>
Expand Down
64 changes: 2 additions & 62 deletions core/src/plugins/access.ajxp_conf/src/UsersManager.php
Expand Up @@ -907,6 +907,8 @@ public function listNodes(ServerRequestInterface $requestInterface, $rootPath, $
}
if(isSet($allUserIds) && count($allUserIds)){
$connections = $logger->usersLastConnection($allUserIds);
}else{
$connections = [];
}

ksort($userArray);
Expand All @@ -921,68 +923,6 @@ public function listNodes(ServerRequestInterface $requestInterface, $rootPath, $
$this->appendBookmarkMeta($bmKey, $meta);
$nodesList->addBranch(new AJXP_Node($nodeKey, $meta));

/*
$repos = ConfService::getConfStorageImpl()->listRepositories($userObject);
$isAdmin = $userObject->isAdmin();
$userId = $userObject->getId();
$icon = "user".($userId=="guest"?"_guest":($isAdmin?"_admin":""));
$iconClass = "icon-user";
if ($userObject->hasParent()) {
$icon = "user_child";
$iconClass = "icon-angle-right";
}
if ($isAdmin) {
$rightsString = $messages["ajxp_conf.63"];
} else {
$r = array();
foreach ($repos as $repoId => $repository) {
if($repository->getAccessType() == "ajxp_shared") continue;
if(!$userObject->canRead($repoId) && !$userObject->canWrite($repoId)) continue;
$rs = ($userObject->canRead($repoId) ? "r" : "");
$rs .= ($userObject->canWrite($repoId) ? "w" : "");
$r[] = $repository->getDisplay()." (".$rs.")";
}
$rightsString = implode(", ", $r);
}
$nodeLabel = UsersService::getUserPersonalParameter("USER_DISPLAY_NAME", $userObject, "core.conf", $userId);
$scheme = UsersService::getAuthScheme($userId);
$nodeKey = $fullBasePath. "/" .$userId;
$roles = array_filter(array_keys($userObject->getRoles()), array($this, "filterReservedRoles"));
$mergedRole = $userObject->mergedRole->getDataArray(true);
$meta = [];
if($format !== "json"){
$mergedRole = json_encode($mergedRole);
$currentRoles = implode(", ", $roles);
$jsonKey = $nodeKey;
}else{
$currentRoles = $roles;
$meta["personal_role_id"] = "/AJXP_USR_/".$userId;
$jsonKey = $userId;
}
$meta = array_merge($meta, [
"text" => $nodeLabel,
"is_file" => true,
"isAdmin" => $messages[($isAdmin?"ajxp_conf.14":"ajxp_conf.15")],
"icon" => $icon.".png",
"icon_class" => $iconClass,
"object_id" => $userId,
"auth_scheme" => ($scheme != null? $scheme : ""),
"rights_summary" => $rightsString,
"ajxp_roles" => $currentRoles,
"ajxp_mime" => "user".(($userId!="guest"&&$userId!=$this->context->getUser()->getId())?"_editable":""),
"json_merged_role" => $mergedRole
]);
if($userObject->hasParent()) {
$meta["shared_user"] = "true";
}
if(isSet($connections) && isSet($connections[$userObject->getId()]) && !empty($connections[$userObject->getId()])) {
$meta["last_connection"] = strtotime($connections[$userObject->getId()]);
$meta["last_connection_readable"] = StatHelper::relativeDate($meta["last_connection"], $messages);
}
$this->appendBookmarkMeta($nodeKey, $meta);
$nodesList->addBranch(new AJXP_Node($jsonKey, $meta));
*/
}
return $nodesList;
}
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/access.ftp/FtpAccessWrapper.php
Expand Up @@ -512,6 +512,7 @@ protected function rawListEntryToStat($entry, $filterStatPerms = false)
$vinfo = preg_split("/[\s]+/", $entry);
Logger::debug(__CLASS__,__FUNCTION__,"RAW LIST", $entry);
$statValue = array();
$fileperms = '';
if ($vinfo[0] !== "total") {
$fileperms = $vinfo[0];
$info['num'] = $vinfo[1];
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/access.sftp_psl/SftpPSLAccessWrapper.php
Expand Up @@ -28,6 +28,7 @@
use Pydio\Access\Driver\StreamProvider\FS\FsAccessWrapper;
use Pydio\Auth\Core\MemorySafe;

use Pydio\Core\Exception\PydioException;
use Pydio\Core\Utils\ApplicationState;
use Pydio\Core\Utils\Vars\InputFilter;
use Pydio\Core\Utils\Vars\UrlUtils;
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/authfront.cas/CasAuthFrontend.php
Expand Up @@ -408,7 +408,7 @@ private function setPTGStorage()
$db_database = "mysql:" . "dbname=" . $dbconfig->sqlDriver["database"] . ";host=" . $dbconfig->sqlDriver["host"];
$db_table = "ajxp_cas_pgt";
Logger::info(__CLASS__, __FUNCTION__, $db_database);
phpCAS::setPGTStorageDB($db_database, $db_username, $db_password, $db_table, "");
phpCAS::setPGTStorageDb($db_database, $db_username, $db_password, $db_table, "");
}
}
break;
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/authfront.otp/OtpAuthFrontend.php
Expand Up @@ -310,6 +310,7 @@ public function oath_hotp($key, $counter)
*/
public function oath_truncate($hash, $length = 6)
{
$hmac_result = [];
// Convert to dec
foreach (str_split($hash, 2) as $hex) {
$hmac_result[] = hexdec($hex);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.access/src/Model/AJXP_Node.php
Expand Up @@ -122,7 +122,7 @@ public function __construct($url, $metadata = [])
*/
public function __sleep()
{
$t = array_diff(array_keys(get_class_vars("AJXP_Node")), ["_accessDriver", "_repository", "_metaStore"]);
$t = array_diff(array_keys(get_class_vars("Pydio\\Access\\Core\\Model\\AJXP_Node")), ["_accessDriver", "_repository", "_metaStore"]);
return $t;
}

Expand Down

0 comments on commit bc5d1fa

Please sign in to comment.