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

Commit

Permalink
Code analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Mar 24, 2016
1 parent b97291f commit 9dc55a6
Show file tree
Hide file tree
Showing 59 changed files with 61 additions and 75 deletions.
3 changes: 2 additions & 1 deletion core/src/cmd.php
Expand Up @@ -200,7 +200,8 @@
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser()!=null) {
$confDriver = ConfService::getConfStorageImpl();
$Driver = ConfService::loadDriverForRepository(ConfService::getRepository());
$loadRepo = ConfService::getRepository();
$Driver = ConfService::loadDriverForRepository($loadRepo);
}
AJXP_PluginsService::getInstance()->initActivePlugins();
require_once(AJXP_BIN_FOLDER."/class.AJXP_Controller.php");
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/classes/class.AJXP_Utils.php
Expand Up @@ -1380,7 +1380,7 @@ public static function loadSerialFile($filePath, $skipCheck = false, $format="se
* Stores an Array as a serialized string inside a file.
*
* @param String $filePath Full path to the file
* @param Array|Object $value The value to store
* @param array|Object $value The value to store
* @param Boolean $createDir Whether to create the parent folder or not, if it does not exist.
* @param bool $silent Silently write the file, are throw an exception on problem.
* @param string $format "ser" or "json"
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/classes/class.ContentFilter.php
Expand Up @@ -25,8 +25,8 @@
*/
class ContentFilter {

var $filters = array();
var $virtualPaths = array();
public $filters = array();
public $virtualPaths = array();

/**
* @param AJXP_Node[] $nodes
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/classes/class.Repository.php
Expand Up @@ -213,7 +213,7 @@ public function createSharedChild($newLabel, $newOptions, $parentId = null, $own
$newOptions["CREATION_USER"] = AuthService::getLoggedUser()->getId();
}
$repo->options = $newOptions;
if ($parentId == null) {
if ($parentId === null) {
$parentId = $this->getId();
}
$repo->setInferOptionsFromParent(true);
Expand Down Expand Up @@ -280,7 +280,7 @@ public function getSlug()
*/
public function setSlug($slug = null)
{
if ($slug == null) {
if ($slug === null) {
$this->slug = AJXP_Utils::slugify($this->display);
} else {
$this->slug = $slug;
Expand Down
22 changes: 12 additions & 10 deletions core/src/plugins/access.fs/class.fsAccessDriver.php
Expand Up @@ -292,7 +292,7 @@ public function switchAction($action, $httpVars, $fileVars)
&& !$this->getFilteredOption("USE_XACCELREDIRECT", $this->repository)){
register_shutdown_function("unlink", $file);
}
$localName = ($base==""?"Files":$base).".zip";
$localName = (empty($base)?"Files":$base).".zip";
if(isSet($httpVars["archive_name"])){
$localName = AJXP_Utils::decodeSecureMagic($httpVars["archive_name"]);
}
Expand Down Expand Up @@ -449,12 +449,12 @@ public function switchAction($action, $httpVars, $fileVars)
} catch (Exception $e) {
header("Content-Type:text/plain");
print $e->getMessage();
return;
break;
}
if (!is_file($fileName) || !$this->isWriteable($fileName, "file")) {
header("Content-Type:text/plain");
print((!$this->isWriteable($fileName, "file")?"1001":"1002"));
return ;
break;
}
$fp=fopen($fileName,"w");
fputs ($fp,$code);
Expand Down Expand Up @@ -944,7 +944,7 @@ public function switchAction($action, $httpVars, $fileVars)

$streamIsSeekable = AJXP_MetaStreamWrapper::wrapperIsSeekable($path);

$sharedHandle = null;
$sharedHandle = null; $handle = null;
if($streamIsSeekable){
$handle = opendir($path);
$sharedHandle = $handle;
Expand Down Expand Up @@ -1089,6 +1089,9 @@ public function switchAction($action, $httpVars, $fileVars)
$breakNow = false;
if(isSet($max_depth) && $max_depth > 0 && $crt_depth >= $max_depth) $breakNow = true;
if(isSet($max_nodes) && $max_nodes > 0 && $crt_nodes >= $max_nodes) $breakNow = true;
/**
* @var $nodeDir AJXP_Node
*/
foreach ($fullList["d"] as &$nodeDir) {
if($breakNow){
$nodeDir->mergeMetadata(array("ajxp_has_children" => $this->countFiles($nodeDir->getUrl(), false, true)?"true":"false"));
Expand Down Expand Up @@ -1284,10 +1287,10 @@ public function loadNodeInfo(&$ajxpNode, $parentNode = false, $details = false)
}

/**
* @param Array $uploadData Php-upload array
* @param array $uploadData Php-upload array
* @param String $destination Destination folder, including stream data
* @param String $filename Destination filename
* @param Array $messages Application messages table
* @param array $messages Application messages table
* @return bool
* @throws Exception
*/
Expand Down Expand Up @@ -1466,7 +1469,7 @@ public function readFile($filePathOrData, $headerType="plain", $localName="", $d
$size = strlen($gzippedData);
}
HTMLWriter::generateAttachmentsHeader($localName, $size, $isFile, $gzip);
if ($gzip) {
if ($gzip && isSet($gzippedData)) {
print $gzippedData;
return;
}
Expand Down Expand Up @@ -1721,7 +1724,6 @@ public static function autoRenameForDest($destination, $fileName)
if(!is_file($destination."/".$fileName)) return $fileName;
$i = 1;
$ext = "";
$name = "";
$split = explode(".", $fileName);
if (count($split) > 1) {
$ext = ".".$split[count($split)-1];
Expand Down Expand Up @@ -1919,7 +1921,7 @@ public function nodeWillChange($node, $newSize = null)
* @param $dest
* @param $basedir
* @throws Exception
* @return zipfile
* @return PclZip
*/
public function makeZip ($src, $dest, $basedir)
{
Expand Down Expand Up @@ -1968,7 +1970,7 @@ public function recursivePurge($dirName, $hardPurgeTime, $softPurgeTime = 0)
$handle=opendir($dirName);
$shareCenter = false;
if(class_exists("ShareCenter")){
$shareCenter = ShareCenter::getShareCenter("action.share");
$shareCenter = ShareCenter::getShareCenter();
}
if($handle === false){
$this->logError(__FUNCTION__, "Cannot open folder ".$dirName);
Expand Down
Expand Up @@ -97,7 +97,6 @@ public function switchAction($action, $httpVars, $filesVars)
$httpClient->directForwarding = true;
}
$result = $httpClient->get($crtRep->getOption("URI"), $httpVars);
$result = $httpClient->get($crtRep->getOption("URI"), $httpVars);
} else {
$result = $httpClient->post($crtRep->getOption("URI"), $httpVars);
}
Expand Down
6 changes: 4 additions & 2 deletions core/src/plugins/auth.multi/class.multiAuthDriver.php
Expand Up @@ -282,13 +282,15 @@ public function preLogUser($remoteSessionId)
if ($this->masterSlaveMode) {
$this->drivers[$this->slaveName]->preLogUser($remoteSessionId);
if (AuthService::getLoggedUser() == null) {
return $this->drivers[$this->masterName]->preLogUser($remoteSessionId);
$this->drivers[$this->masterName]->preLogUser($remoteSessionId);
return;
}
return;
}

if ($this->getCurrentDriver()) {
return $this->getCurrentDriver()->preLogUser($remoteSessionId);
$this->getCurrentDriver()->preLogUser($remoteSessionId);
return;
} else {
throw new Exception("No driver instanciated in multi driver!");
}
Expand Down
1 change: 0 additions & 1 deletion core/src/plugins/boot.conf/i18n/conf/de.php
Expand Up @@ -64,7 +64,6 @@
"Your system title" => "Titel dieser Installation von Pydio",
"Welcome Message" => "Willkommens-Mitteilung",
"An additional message displayed at startup, on the splash screen and the login screen." => "Eine zusätzliche Mitteilung für die Anmelde-Seite.",
"Admin Display Name" => "Angezeigter Name",
"User-friendly name of the user" => "Namen den die Benutzer sehen",
"Welcome to Pydio" => "Willkommen bei Pydio",
"Database Connexion" => "Datenbankverbindung",
Expand Down
1 change: 0 additions & 1 deletion core/src/plugins/boot.conf/i18n/conf/en.php
Expand Up @@ -64,7 +64,6 @@
"Your system title" => "Your system title",
"Welcome Message" => "Welcome Message",
"An additional message displayed at startup, on the splash screen and the login screen." => "An additional message displayed at startup, on the splash screen and the login screen.",
"Admin Display Name" => "Admin Display Name",
"User-friendly name of the user" => "User-friendly name of the user",
"Welcome to Pydio" => "Welcome to Pydio",
"Database Connexion" => "Database Connexion",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/conf.serial/class.AJXP_SerialUser.php
Expand Up @@ -221,7 +221,7 @@ public function saveTemporaryData($key, $value)
{
$fastCheck = $this->storage->getOption("FAST_CHECKS");
$fastCheck = ($fastCheck == "true" || $fastCheck == true);
return AJXP_Utils::saveSerialFile($this->getStoragePath()."/".$key.".ser", $value, !$fastCheck);
AJXP_Utils::saveSerialFile($this->getStoragePath()."/".$key.".ser", $value, !$fastCheck);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/conf.serial/class.serialConfDriver.php
Expand Up @@ -110,7 +110,7 @@ public function _savePluginConfig($pluginId, $options)
// SAVE / EDIT / CREATE / DELETE REPOSITORY
/**
* @param AbstractAjxpUser $user
* @return Array
* @return array
*/
public function listRepositories($user = null)
{
Expand Down
5 changes: 2 additions & 3 deletions core/src/plugins/core.access/class.AbstractAccessDriver.php
Expand Up @@ -208,7 +208,6 @@ protected function copyOrMoveFile($destDir, $srcFile, &$error, &$success, $move
return ;
} else {
$base = basename($srcFile);
$i = 1;
if (is_file($realSrcFile)) {
$dotPos = strrpos($base, ".");
if ($dotPos>-1) {
Expand Down Expand Up @@ -253,9 +252,9 @@ protected function copyOrMoveFile($destDir, $srcFile, &$error, &$success, $move
AJXP_Controller::applyHook("node.before_path_change", array($srcNode));
if(file_exists($destFile)) unlink($destFile);
if(AJXP_MetaStreamWrapper::nodesUseSameWrappers($realSrcFile, $destFile)){
$res = rename($realSrcFile, $destFile);
rename($realSrcFile, $destFile);
}else{
$res = copy($realSrcFile, $destFile);
copy($realSrcFile, $destFile);
}
AJXP_Controller::applyHook("node.change", array($srcNode, $destNode, false));
} else {
Expand Down
1 change: 0 additions & 1 deletion core/src/plugins/core.access/src/Stream/OAuthWrapper.php
Expand Up @@ -13,7 +13,6 @@
require_once(AJXP_BIN_FOLDER . '/guzzle/vendor/autoload.php');

use AJXP_SchemeTranslatorWrapper;
use AJXP_Safe;
use AJXP_Utils;
use AuthService;
use CacheService;
Expand Down
1 change: 0 additions & 1 deletion core/src/plugins/core.access/src/Stream/PathWrapper.php
Expand Up @@ -11,7 +11,6 @@
defined('AJXP_EXEC') or die('Access not allowed');

use AJXP_SchemeTranslatorWrapper;
use AJXP_Safe;
use AJXP_Utils;
use CacheService;
use ConfService;
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/ca.php
Expand Up @@ -588,7 +588,7 @@
"528"=> "Usuaris interns",
"530"=> "Usuaris externs",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identificador emprat per accedir, per favor empri caràcters alfanumèrics en minúscules o correu electrònic.",
"534" => "Contrasenya emprada per acceder",
"535" => "Enviar contrasenya per correu electrònic",
Expand Down
1 change: 0 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/conf/it.php
Expand Up @@ -91,7 +91,6 @@
"When a folder will contain more items than this number, display will switch to pagination mode, for better performances." => "Quando una cartella contiene più elementi rispetto a quanto indicato quì, la visualizzazione passerà alla modalità paginazione, per migliorare le performance.",
"#Items per page" => "#Elementi per pagina",
"Once in pagination mode, number of items to display per page." => "Una volta in modalità paginazione, indica il numero di elementi da mostrare per ciascuna pagina.",
"Default Metasources" => "Sorgenti META Principale",
"Comma separated list of metastore and meta plugins, that will be automatically applied to all repositories created with this driver" => "Lista, separata da virgola, di plugin metastore e meta, che verrà automaticamente applicata a tutti i workspace creati con questo driver",
"Auth Driver Commons" => "Driver Comuni Autenticazione",
"Transmit Clear Pass" => "Trasmetti Password in chiaro",
Expand Down
1 change: 0 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/conf/pt.php
Expand Up @@ -113,7 +113,6 @@
"Hide files" => "Ocultar Ficheiros",
"Comma-separated list of specific files to hide" => "Lista de ficheiros a esconder, separada por virgulas",
"Metadata and indexation" => "Indexação e Metadata",
"Default Metasources" => "Fontes Meta pré-Definidas",
"Comma-separated list of metastore and meta plugins, that will be automatically applied to all repositories created with this driver" => "Lista de Fontes Meta e de Meta Plugins, separada por virgulas, que irá ser aplicada automaticamente a todas as Áreas de Trabalho criadas por este controlador",
"Absolute path to the public folder where temporary download links will be created. Setting this empty will disable the sharing feature." => "Absolute path to the public folder where temporary download links will be created. Setting this empty will disable the sharing feature.",
"Admin email" => "Admin email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/cs.php
Expand Up @@ -587,7 +587,7 @@
"528"=> "Interními uživateli",
"530"=> "Externími uživateli",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifikátor použitý pro přihlášení, použijte prosím pouze písmena a čísla nebo znaky emailu malými písmeny.",
"534" => "Heslo pro přihlášení",
"535" => "Poslat heslo e-mailem",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/da.php
Expand Up @@ -590,7 +590,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/de.php
Expand Up @@ -594,7 +594,7 @@
"528"=> "Interne Benutzer",
"530"=> "Externe Benutzer",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Sende Passwort via E-Mail",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/en.php
Expand Up @@ -587,7 +587,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/es.php
Expand Up @@ -592,7 +592,7 @@
"528"=> "Usuarios internos",
"530"=> "Usuarios externos",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identificador usado para acceder, por favor utilice caracteres alfanuméricos en minúsculas o correo electrónico.",
"534" => "Contraseña usada para acceder",
"535" => "Enviar contraseña por correo electrónico",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/et.php
Expand Up @@ -588,7 +588,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/eus.php
Expand Up @@ -586,7 +586,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/fi.php
Expand Up @@ -588,7 +588,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/fr.php
Expand Up @@ -587,7 +587,7 @@
"528"=> "Utilisateurs internes",
"530"=> "Utilisateurs externes",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifiant utilisé pour se logger, veuillez utiliser des caractères alphanumériques ou d'email, en minuscule.",
"534" => "Mot de passe utilisé pour se logger",
"535" => "Envoyer le mot de passe par email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/gr.php
Expand Up @@ -585,7 +585,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/he.php
Expand Up @@ -585,7 +585,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/hu.php
Expand Up @@ -590,7 +590,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/it.php
Expand Up @@ -605,7 +605,7 @@
"528"=> "Utenti Interni",
"530"=> "Utenti Esterni",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/ja.php
Expand Up @@ -590,7 +590,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.ajaxplorer/i18n/kr.php
Expand Up @@ -594,7 +594,7 @@
"528"=> "Internal users",
"530"=> "External users",
"531"=> "Users",
"531"=> "Groups",
"532"=> "Groups",
"533" => "Identifier used to login, please use alphanumeric or email lowercase characters.",
"534" => "Password used to login",
"535" => "Send password by email",
Expand Down

0 comments on commit 9dc55a6

Please sign in to comment.