Permalink
Browse files

Code smells and other unused imports

  • Loading branch information...
1 parent 10ee151 commit bc5d1fabe23124f3682e15af0792dbc52f65c28a @cdujeu cdujeu committed Sep 12, 2016
@@ -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;
@@ -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;
@@ -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; }
@@ -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>
@@ -907,6 +907,8 @@ public function listNodes(ServerRequestInterface $requestInterface, $rootPath, $
}
if(isSet($allUserIds) && count($allUserIds)){
$connections = $logger->usersLastConnection($allUserIds);
+ }else{
+ $connections = [];
}
ksort($userArray);
@@ -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;
}
@@ -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];
@@ -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;
@@ -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;
@@ -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);
@@ -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;
}

0 comments on commit bc5d1fa

Please sign in to comment.